mirror of
https://github.com/loot/libloot.git
synced 2026-07-27 14:16:01 -07:00
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:
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user