Fixed uaddCarray and updated tests #253

This commit is contained in:
Christophe Riccio
2014-11-15 22:31:08 +01:00
parent b90c4c430e
commit 72cbc4c065
2 changed files with 28 additions and 51 deletions

View File

@@ -95,7 +95,7 @@ namespace detail
uint64 const Value64(static_cast<uint64>(x) + static_cast<uint64>(y));
uint64 const Max32(static_cast<uint64>(std::numeric_limits<uint>::max()));
Carry = Value64 > Max32 ? 1 : 0;
return static_cast<uint32>(Value64 % Max32);
return static_cast<uint32>(Value64 % (Max32 + static_cast<uint64>(1)));
}
template <precision P, template <typename, precision> class vecType>
@@ -104,7 +104,7 @@ namespace detail
vecType<uint64, P> Value64(vecType<uint64, P>(x) + vecType<uint64, P>(y));
vecType<uint64, P> Max32(static_cast<uint64>(std::numeric_limits<uint>::max()));
Carry = mix(vecType<uint32, P>(0), vecType<uint32, P>(1), greaterThan(Value64, Max32));
return vecType<uint32,P>(Value64 % Max32);
return vecType<uint32,P>(Value64 % (Max32 + static_cast<uint64>(1)));
}
// usubBorrow