chore(big): style and warning fixes

This commit is contained in:
Adam Heinermann 2024-11-17 02:10:24 -08:00 committed by superp00t
parent c616d351a9
commit 8e96181679
7 changed files with 26 additions and 26 deletions

View file

@ -52,12 +52,12 @@ void Div(BigBuffer& a, uint32_t* b, const BigBuffer& c, uint64_t d) {
uint64_t data = 0;
while (index > 0) {
InsertLowPart(data, c[--index]);
a[index] = data / d;
a[index] = static_cast<uint32_t>(data / d);
data %= d;
}
a.Trim();
*b = data;
*b = static_cast<uint32_t>(data);
}
void Div(BigBuffer& a, BigBuffer& b, const BigBuffer& c, const BigBuffer& d, BigStack& stack) {
@ -102,7 +102,7 @@ void Div(BigBuffer& a, BigBuffer& b, const BigBuffer& c, const BigBuffer& d, Big
cc.SetOffset(v12 - 1);
if (t) {
a[0] = MakeLarge(cc[dCount - 1], cc[dCount]) / t;
a[0] = static_cast<uint32_t>(MakeLarge(cc[dCount - 1], cc[dCount]) / t);
} else {
a[0] = cc[dCount];
}
@ -437,8 +437,7 @@ void Sub(BigBuffer& a, const BigBuffer& b, const BigBuffer& c) {
}
a.SetCount(i);
// This assert does not exist in retail WoW or Starcraft.
//STORM_ASSERT(!borrow);
STORM_ASSERT(!borrow);
}
void Sub(BigBuffer& a, const BigBuffer& b, uint32_t c) {
@ -451,8 +450,7 @@ void Sub(BigBuffer& a, const BigBuffer& b, uint32_t c) {
}
a.SetCount(i);
// This assert does not exist in retail WoW or Starcraft.
//STORM_ASSERT(!borrow);
STORM_ASSERT(!borrow);
}
void ToBinaryAppend(TSGrowableArray<uint8_t>& output, const BigBuffer& buffer) {

View file

@ -1,10 +1,6 @@
#include "storm/thread/S_Thread.hpp"
#include "storm/Memory.hpp"
#ifndef WINAPI
#define WINAPI
#endif
DWORD WINAPI S_Thread::s_SLaunchThread(void* threadParam) {
auto params = static_cast<SThreadParmBlock*>(threadParam);
auto proc = params->threadProc;

View file

@ -171,6 +171,7 @@ TEST_CASE("SBigDec", "[big]") {
CHECK(a->Primary()[0] == 4);
}
#ifdef NDEBUG
SECTION("decrements from 0") {
SBigFromUnsigned(b, 0);
@ -179,6 +180,7 @@ TEST_CASE("SBigDec", "[big]") {
CHECK(a->Primary().Count() == 1);
CHECK(a->Primary()[0] == 0xFFFFFFFF);
}
#endif
}
TEST_CASE("SBigDiv", "[big]") {
@ -611,8 +613,8 @@ TEST_CASE("SBigOr", "[big]") {
SBigOr(a, b, c);
CHECK(a->Primary().Count() == 2);
CHECK(a->Primary()[0] == uint32_t(v.first | v.second));
CHECK(a->Primary()[1] == uint32_t((v.first | v.second) >> 32));
CHECK(a->Primary()[0] == 0xFFFFFFFF);
CHECK(a->Primary()[1] == 0xFFFFFFFF);
}
SECTION("performs bitwise or on huge value") {
@ -694,6 +696,7 @@ TEST_CASE("SBigSub", "[big]") {
CHECK(a->Primary()[0] == 1);
}
#ifdef NDEBUG
SECTION("subtracts 1 from 0") {
SBigFromUnsigned(b, 0);
SBigFromUnsigned(c, 1);
@ -703,6 +706,7 @@ TEST_CASE("SBigSub", "[big]") {
CHECK(a->Primary().Count() == 1);
CHECK(a->Primary()[0] == 0xFFFFFFFF);
}
#endif
}
TEST_CASE("SBigToBinaryBuffer", "[big]") {

View file

@ -970,6 +970,7 @@ TEST_CASE("Sub", "[big]") {
CHECK(a->Primary()[0] == 1);
}
#ifdef NDEBUG
SECTION("subtracts 1 from 0") {
SBigFromUnsigned(b, 0);
SBigFromUnsigned(c, 1);
@ -988,6 +989,7 @@ TEST_CASE("Sub", "[big]") {
CHECK(a->Primary().Count() == 1);
CHECK(a->Primary()[0] == 0xFFFFFFFF);
}
#endif
SECTION("subtracts 1 from 2") {
SBigFromUnsigned(b, 2);