Remove custom modulo implementation.

Now that automated tests have verified that the expected C++11 behaviour
is implemented in the MSVC 2013 and GCC 5 C++ runtimes.
This commit is contained in:
Oliver Hamlet
2015-07-12 18:37:18 +01:00
parent a6d18cb57d
commit cfc1820c42
4 changed files with 3 additions and 16 deletions
-10
View File
@@ -64,16 +64,6 @@ namespace loot {
// Helper functions
//////////////////////////////////////////////////////////////////////////
//Calculate modulo with dividend sign preserved, matching behaviour of C++11.
int modulo(int dividend, int divisor) {
divisor = abs(divisor);
if (dividend < 0) {
return -1 * (abs(dividend) % divisor);
}
else
return dividend % divisor;
}
//Calculate the CRC of the given file for comparison purposes.
uint32_t GetCrc32(const fs::path& filename) {
uint32_t chksum = 0;
-3
View File
@@ -38,9 +38,6 @@ namespace loot {
// Helper functions
//////////////////////////////////////////////////////////////////////////
//Calculate modulo with dividend sign preserved, matching behaviour of C++11.
int modulo(int dividend, int divisor);
//Calculate the CRC of the given file for comparison purposes.
uint32_t GetCrc32(const boost::filesystem::path& filename);
+2 -2
View File
@@ -340,8 +340,8 @@ namespace loot {
vertex_t vertex, parentVertex;
//Modulo operator is not consistently defined for negative numbers except in C++11, so use function.
int p1 = modulo(graph[*vit].Priority(), max_priority);
int p2 = modulo(graph[*vit2].Priority(), max_priority);
int p1 = graph[*vit].Priority() % max_priority;
int p2 = graph[*vit2].Priority() % max_priority;
if (p1 < p2) {
parentVertex = *vit;
vertex = *vit2;
+1 -1
View File
@@ -1021,7 +1021,7 @@ namespace loot {
// Now add to pluginNode.
YAML::Node pluginNode;
pluginNode["name"] = tempPlugin.Name();
pluginNode["modPriority"] = modulo(tempPlugin.Priority(), max_priority);
pluginNode["modPriority"] = tempPlugin.Priority() % max_priority;
pluginNode["isGlobalPriority"] = (abs(tempPlugin.Priority()) >= max_priority);
pluginNode["messages"] = tempPlugin.Messages();
pluginNode["tags"] = tempPlugin.Tags();