Fix bug in setting precomputed power-of-10

This commit is contained in:
2025-03-09 09:44:03 +03:00
parent fc3d4e22d5
commit 8009498331
2 changed files with 22 additions and 24 deletions

View File

@@ -26,7 +26,6 @@ static const uint8_t clzLookup[256] =
}; };
static const uint16_t pow10Data[] = static const uint16_t pow10Data[] =
{ {
0x0001, 0x000A, 0x0064, 0x2710, 0xE100, 0x05F5, 0x0000, 0x6FC1, 0x0001, 0x000A, 0x0064, 0x2710, 0xE100, 0x05F5, 0x0000, 0x6FC1,
@@ -62,7 +61,7 @@ static void pow10Set(int index,
BH_Int1120 *out) BH_Int1120 *out)
{ {
out->size = pow10Size[index]; out->size = pow10Size[index];
memcpy(out->digits, pow10Data + pow10Index[index], out->size); memcpy(out->digits, pow10Data + pow10Index[index], out->size * sizeof(uint16_t));
} }

View File

@@ -25,7 +25,6 @@ typedef struct BH_Int1120
int BH_Int1120Clz(const uint16_t value); int BH_Int1120Clz(const uint16_t value);
/** /**
* Compares big integers \a a and \a b. * Compares big integers \a a and \a b.
* *