IntToU64
Description
Convert an integer to u64.
This public macro supports both forms:
IntToU64(value)- returns the result, no error channel.IntToU64(value, error)- writes the error flag througherror.
Parameters
| Name | Direction | Description |
|---|---|---|
value |
in | Integer to convert. |
error |
out | Optional pointer set to true on failure and false on success. |
Usage example (from documentation)
u64 v = IntToU64(&big);Success
Returns the numeric value as a u64. The integer is not modified.
Failure
Returns 0 when the value does not fit in 64 bits. With the two-argument form *error is set to true; with the one-argument form the caller cannot distinguish overflow from a true zero result.
Usage example (Cross-references)
Usage examples (Cross-references)
- In
Int.c:813:
return false;
}
rem = IntToU64(&remainder);
last = IntIsZero("ient);- In
Int.c:1545:
}
return int_pow_u64(result, base, IntToU64(exponent));
}- In
Int.c:1879:
return 0;
}
rem = IntToU64(&remainder);
IntDeinit(&divisor_value);- In
Type.c:57:
bool result = IntEQ(&clone, &original);
result = result && (IntToU64(&clone) == 11);
IntShiftLeft(&original, 1);- In
Type.c:62:
result = result && !IntEQ(&clone, &original);
result = result && (IntToU64(&clone) == 11);
result = result && (IntToU64(&original) == 22);- In
Type.c:63:
result = result && !IntEQ(&clone, &original);
result = result && (IntToU64(&clone) == 11);
result = result && (IntToU64(&original) == 22);
IntDeinit(&original);- In
Type.c:125:
IntAdd(&sum, &a, &b);
bool result = (IntToU64(&sum) == 256);
result = result && (IntBitLength(&sum) == 9);- In
Type.c:149:
bool result = IntBitLength(&v255) == 8;
result = result && (IntToU64(&v255) == 255);
IntDeinit(&v255);- In
Math.c:81:
IntShiftLeft(&value, 4);
bool result = IntToU64(&value) == 48;
result = result && (IntBitLength(&value) == 6);- In
Math.c:98:
IntShiftRight(&value, 4);
bool result = IntToU64(&value) == 3;
result = result && (IntBitLength(&value) == 2);- In
Math.c:119:
text = IntToBinary(&result_value);
bool result = IntToU64(&result_value) == 256;
result = result && (ZstrCompare(StrBegin(&text), "100000000") == 0);- In
Math.c:142:
IntAdd(&result_value, &base, &rhs);
bool result = IntToU64(&result_value) == 42;
IntAdd(&result_value, &base, 2);- In
Math.c:145:
IntAdd(&result_value, &base, 2);
result = result && (IntToU64(&result_value) == 42);
IntAdd(&result_value, &base, -2);- In
Math.c:148:
IntAdd(&result_value, &base, -2);
result = result && (IntToU64(&result_value) == 38);
IntAdd(&result_value, &huge, 10);- In
Math.c:173:
bool result = IntSub(&result_value, &a, &b);
result = result && (IntToU64(&result_value) == 255);
IntDeinit(&a);- In
Math.c:195:
bool result = IntSub(&result_value, &base, &rhs);
result = result && (IntToU64(&result_value) == 38);
result = result && IntSub(&result_value, &base, 2u);- In
Math.c:198:
result = result && IntSub(&result_value, &base, 2u);
result = result && (IntToU64(&result_value) == 38);
result = result && IntSub(&result_value, &base, -2);- In
Math.c:201:
result = result && IntSub(&result_value, &base, -2);
result = result && (IntToU64(&result_value) == 42);
result = result && IntSub(&result_value, &huge, 90);- In
Math.c:208:
result = result && !IntSub(&preserved, &base, 50);
result = result && (IntToU64(&preserved) == 99);
IntDeinit(&base);- In
Math.c:230:
bool result = !IntSub(&result_value, &a, &b);
result = result && (IntToU64(&result_value) == 99);
IntDeinit(&a);- In
Math.c:250:
IntMul(&result_value, &a, &b);
bool result = IntToU64(&result_value) == 126;
IntDeinit(&a);- In
Math.c:292:
bool result = IntIsZero(&result_value);
result = result && (IntToU64(&result_value) == 0);
IntDeinit(&a);- In
Math.c:311:
IntSquare(&result_value, &value);
bool result = IntToU64(&result_value) == 152399025;
IntDeinit(&value);- In
Math.c:360:
bool result = ZstrCompare(StrBegin(&qtext), "127275040218913071") == 0;
result = result && (IntToU64(&remainder) == 3);
StrDeinit(&qtext);- In
Math.c:380:
IntDiv(&result_value, ÷nd, 10u);
bool result = IntToU64(&result_value) == 12;
IntDeinit(÷nd);- In
Math.c:418:
bool result = !IntDivExact(&result_value, ÷nd, &divisor);
result = result && (IntToU64(&result_value) == 99);
IntDeinit(÷nd);- In
Math.c:441:
bool result = ZstrCompare(StrBegin(&text), "127275040218913071") == 0;
result = result && (IntToU64(&remainder) == 3);
IntDeinit(÷nd);- In
Math.c:461:
IntMod(&result_value, ÷nd, 10u);
bool result = IntToU64(&result_value) == 6;
IntDeinit(÷nd);- In
Math.c:480:
IntDeinit(&value);
bool result = IntToU64(&remainder) == 3;
IntDeinit(&remainder);
DefaultAllocatorDeinit(&alloc);- In
Math.c:497:
IntGCD(&result_value, &a, &b);
bool result = IntToU64(&result_value) == 6;
IntDeinit(&a);- In
Math.c:517:
IntLCM(&result_value, &a, &b);
bool result = IntToU64(&result_value) == 42;
IntDeinit(&a);- In
Math.c:536:
IntRoot(&result_value, &value, 4);
bool result = IntToU64(&result_value) == 8;
IntDeinit(&value);- In
Math.c:555:
IntRootRem(&root, &remainder, &value, 3);
bool result = IntToU64(&root) == 5;
result = result && (IntToU64(&remainder) == 75);- In
Math.c:556:
bool result = IntToU64(&root) == 5;
result = result && (IntToU64(&remainder) == 75);
IntDeinit(&value);- In
Math.c:575:
IntSqrt(&result_value, &value);
bool result = IntToU64(&result_value) == 14;
IntDeinit(&value);- In
Math.c:594:
IntSqrtRem(&root, &remainder, &value);
bool result = IntToU64(&root) == 14;
result = result && (IntToU64(&remainder) == 4);- In
Math.c:595:
bool result = IntToU64(&root) == 14;
result = result && (IntToU64(&remainder) == 4);
IntDeinit(&value);- In
Math.c:673:
IntSquareMod(&result_value, &value, &mod);
bool result = IntToU64(&result_value) == 94;
IntDeinit(&value);- In
Math.c:694:
IntModAdd(&result_value, &a, &b, &m);
bool result = IntToU64(&result_value) == 12;
IntDeinit(&a);- In
Math.c:716:
IntModSub(&result_value, &a, &b, &m);
bool result = IntToU64(&result_value) == 9;
IntDeinit(&a);- In
Math.c:738:
IntModMul(&result_value, &a, &b, &m);
bool result = IntToU64(&result_value) == 22;
IntDeinit(&a);- In
Math.c:760:
bool result = IntModDiv(&result_value, &a, &b, &m);
result = result && (IntToU64(&result_value) == 12);
IntModMul(&check, &result_value, &b, &m);- In
Math.c:785:
IntPowMod(&result_value, &base, 20u, &mod);
bool result = IntToU64(&result_value) == 3;
IntDeinit(&base);- In
Math.c:806:
IntPowMod(&result_value, &base, &exp, &mod);
bool result = IntToU64(&result_value) == 445;
IntDeinit(&base);- In
Math.c:827:
bool result = IntModInv(&result_value, &value, &mod);
result = result && (IntToU64(&result_value) == 4);
IntModMul(&check, &value, &result_value, &mod);- In
Math.c:830:
IntModMul(&check, &value, &result_value, &mod);
result = result && (IntToU64(&check) == 1);
IntDeinit(&value);- In
Math.c:929:
bool result = !IntModInv(&result_value, &value, &mod);
result = result && (IntToU64(&result_value) == 99);
IntDeinit(&value);- In
Math.c:1543:
bool ok = IntMul(&product, &a, &b);
bool result = ok && (IntToU64(&product) == (u64)121932631112635269ull);
IntDeinit(&a);- In
Math.c:1569:
bool result = ok && IntIsZero(&product);
result = result && (IntToU64(&product) == 0u);
result = result && (IntBitLength(&product) == 0u);- In
Math.c:1609:
// exponent 0 -> 1 (loop body never runs)
IntPow(&result, &base, 0u);
bool ok = IntToU64(&result) == 1;
// exponent 1 -> base (one odd bit, no squaring)
- In
Math.c:1613:
// exponent 1 -> base (one odd bit, no squaring)
IntPow(&result, &base, 1u);
ok = ok && (IntToU64(&result) == 7);
// exponent 2 -> 49 (squaring path)
- In
Math.c:1617:
// exponent 2 -> 49 (squaring path)
IntPow(&result, &base, 2u);
ok = ok && (IntToU64(&result) == 49);
// exponent 5 -> 16807 (mixed odd/even bits)
- In
Math.c:1621:
// exponent 5 -> 16807 (mixed odd/even bits)
IntPow(&result, &base, 5u);
ok = ok && (IntToU64(&result) == 16807);
IntDeinit(&base);- In
Math.c:1766:
bool ok = IntSub(&result_value, &a, &b);
ok = ok && (IntToU64(&result_value) == 3);
IntDeinit(&a);- In
Math.c:1932:
Str bits = IntToBinary(&sum);
bool result = (IntToU64(&sum) == 128u);
result = result && (ZstrCompare(StrBegin(&bits), "10000000") == 0);- In
Math.c:1982:
bool ok = IntRootRem(&root, &remainder, &value, 2);
bool result = ok;
result = result && (IntToU64(&root) == 100);
result = result && (IntToU64(&remainder) == 0);- In
Math.c:1983:
bool result = ok;
result = result && (IntToU64(&root) == 100);
result = result && (IntToU64(&remainder) == 0);
IntDeinit(&value);- In
Math.c:2005:
bool ok = IntRootRem(&root, &remainder, &value, 3);
bool result = ok;
result = result && (IntToU64(&root) == 10);
result = result && (IntToU64(&remainder) == 0);- In
Math.c:2006:
bool result = ok;
result = result && (IntToU64(&root) == 10);
result = result && (IntToU64(&remainder) == 0);
IntDeinit(&value);- In
Math.c:2029:
bool ok = IntRootRem(&root, &remainder, &value, 3);
bool result = ok;
result = result && (IntToU64(&root) == 10);
result = result && (IntToU64(&remainder) == 1);- In
Math.c:2030:
bool result = ok;
result = result && (IntToU64(&root) == 10);
result = result && (IntToU64(&remainder) == 1);
IntDeinit(&value);- In
Math.c:2052:
bool ok = IntRootRem(&root, &remainder, &value, 3);
bool result = ok;
result = result && (IntToU64(&root) == 9);
result = result && (IntToU64(&remainder) == 270);- In
Math.c:2053:
bool result = ok;
result = result && (IntToU64(&root) == 9);
result = result && (IntToU64(&remainder) == 270);
IntDeinit(&value);- In
Math.c:2075:
bool ok = IntRootRem(&root, &remainder, &value, 4);
bool result = ok;
result = result && (IntToU64(&root) == 31);
result = result && (IntToU64(&remainder) == 76479);- In
Math.c:2076:
bool result = ok;
result = result && (IntToU64(&root) == 31);
result = result && (IntToU64(&remainder) == 76479);
IntDeinit(&value);- In
Math.c:2107:
bool ok = IntPow(&power, &base, &exp);
bool result = ok;
result = result && (IntToU64(&power) == 16807u);
IntDeinit(&base);- In
Math.c:2164:
bool ok = IntDiv("ient, ÷nd, (i64)7);
bool result = ok;
result = result && (IntToU64("ient) == 142u);
IntDeinit(÷nd);- In
Math.c:2210:
bool ok = IntDivExact("ient, ÷nd, (i64)7);
bool result = ok;
result = result && (IntToU64("ient) == 143u);
IntDeinit(÷nd);- In
Math.c:2303:
/* Signed literal forces int_mul_i64 dispatch. */
bool ok = IntMul(&result_value, &value, (i64)13);
bool result = ok && (IntToU64(&result_value) == 91);
IntDeinit(&value);- In
Math.c:2327:
bool ok = IntMul(&result_value, &value, (i64)0);
bool result = ok && (IntToU64(&result_value) == 0);
IntDeinit(&value);- In
Math.c:2352:
bool ok = IntPow(&result_value, &base, (i64)4);
bool result = ok && (IntToU64(&result_value) == 81);
IntDeinit(&base);- In
Math.c:2376:
bool ok = IntPow(&result_value, &base, (i64)0);
bool result = ok && (IntToU64(&result_value) == 1);
IntDeinit(&base);- In
Math.c:2401:
/* Unsigned literal forces int_div_u64 dispatch. */
bool ok = IntDiv(&result_value, ÷nd, 7u);
bool result = ok && (IntToU64(&result_value) == 14);
IntDeinit(÷nd);- In
Math.c:2426:
bool result = ok;
result = result && (IntToU64(&result_value) == 41152263u);
IntDeinit(÷nd);- In
Math.c:2454:
bool result = ok;
result = result && (ZstrCompare(StrBegin(&qtext), "127275040218913071") == 0);
result = result && (IntToU64(&remainder) == 3u);
StrDeinit(&qtext);- In
Math.c:2484:
bool result = ok;
result = result && (ZstrCompare(StrBegin(&qtext), "949667607787274453") == 0);
result = result && (IntToU64(&remainder) == 1u);
StrDeinit(&qtext);- In
Math.c:2512:
bool result = ok;
result = result && (IntToU64(&result_value) == 1u);
IntDeinit(÷nd);- In
Math.c:2540:
bool result = ok;
result = result && (IntToU64(&result_value) == 889009735u);
IntDeinit(&base);- In
Math.c:2567:
bool result = ok;
result = result && (IntToU64(&result_value) == 1u);
IntDeinit(&base);- In
Math.c:2591:
bool result = ok;
result = result && (IntToU64(&result_value) == 8u);
IntDeinit(&value);- In
Math.c:2637:
bool ok = IntMod(&result, ÷nd, (unsigned long)7u);
bool correct = ok && (IntToU64(&result) == (u64)2u);
IntDeinit(&result);- In
Math.c:2718:
bool pass = ok;
/* 3 * 4 = 12 == 1 (mod 11), so the inverse is 4. */
pass = pass && (IntToU64(&result) == 4);
IntModMul(&check, &value, &result, &mod);- In
Math.c:2721:
IntModMul(&check, &value, &result, &mod);
pass = pass && (IntToU64(&check) == 1);
IntDeinit(&value);- In
Math.c:2750:
bool pass = ok;
pass = pass && (IntToU64(&result) == 9);
IntModMul(&check, &value, &result, &mod);- In
Math.c:2753:
IntModMul(&check, &value, &result, &mod);
pass = pass && (IntToU64(&check) == 1);
IntDeinit(&value);- In
Math.c:2939:
bool ok = IntSqrtRem(&root, &remainder, &value);
bool result = ok && (IntToU64(&root) == 33554432u); // 2^25
result = result && (IntToU64(&remainder) == 0);- In
Math.c:2940:
bool ok = IntSqrtRem(&root, &remainder, &value);
bool result = ok && (IntToU64(&root) == 33554432u); // 2^25
result = result && (IntToU64(&remainder) == 0);
IntDeinit(&value);- In
Math.c:3195:
bool result = ok;
result = result && (IntToU64("ient) == 10309278u);
result = result && (IntToU64(&remainder) == 41u);- In
Math.c:3196:
bool result = ok;
result = result && (IntToU64("ient) == 10309278u);
result = result && (IntToU64(&remainder) == 41u);
IntDeinit(÷nd);- In
Math.c:3224:
bool result = ok;
result = result && (IntToU64("ient) == 123456789u);
result = result && IntIsZero(&remainder);- In
Math.c:3253:
bool result = ok;
result = result && IntIsZero("ient);
result = result && (IntToU64(&remainder) == 42u);
IntDeinit(÷nd);- In
Math.c:3386:
bool ok = int_pow_mod(&result_value, &base, &exp, &mod);
ok = ok && (IntToU64(&result_value) == 444);
IntDeinit(&base);- In
Math.c:3438:
bool ok = IntNextPrime(&next, &value);
bool result = ok && (IntToU64(&next) == 2);
IntDeinit(&value);- In
Math.c:3466:
bool ok = IntNextPrime(&next, &value);
bool result = ok && (IntToU64(&next) == 11);
IntDeinit(&value);- In
Math.c:3489:
bool ok = IntNextPrime(&next, &value);
bool result = ok && (IntToU64(&next) == 11);
IntDeinit(&value);- In
Math.c:3533:
bool ok = IntModSub(&result_value, &a, &b, &m);
ok = ok && (IntToU64(&result_value) == 4);
IntDeinit(&a);- In
Math.c:3580:
bool ok = IntPowMod(&result_value, &base, 13u, &mod);
bool result = ok && (IntToU64(&result_value) == 12);
IntDeinit(&base);- In
Math.c:3602:
bool ok = IntPowMod(&result_value, &base, 0u, &mod);
bool result = ok && (IntToU64(&result_value) == 1);
IntDeinit(&base);- In
Math.c:3626:
bool ok = IntPowMod(&result_value, &base, 64u, &mod);
bool result = ok && (IntToU64(&result_value) == 582344008);
IntDeinit(&base);- In
Math.c:3689:
bool ok = IntMul(&r, &x, &y);
ok = ok && IntToU64(&r) == 123456ull * 7891011ull;
IntDeinit(&x);- In
Math.c:3727:
bool ok = IntAdd(&r, &x, &y);
ok = ok && IntToU64(&r) == 0xFFFFFFFFull + 0xFFFFFFFFull;
IntDeinit(&x);- In
Math.c:3746:
bool ok = IntSub(&r, &x, &y);
ok = ok && IntToU64(&r) == 17u;
IntDeinit(&x);- In
Math.c:3766:
bool ok = IntAdd(&r, &x, 250u);
ok = ok && IntToU64(&r) == 750u;
IntDeinit(&x);- In
Math.c:3785:
bool ok = IntMul(&r, &x, 13u);
ok = ok && IntToU64(&r) == 6500u;
IntDeinit(&x);- In
Math.c:3802:
bool ok = IntSub(&r, &x, 250u); // int_sub_u64 frees rhs on success (1187)
ok = ok && IntToU64(&r) == 750u;
IntDeinit(&x);- In
Math.c:3823:
bool ok = IntDivMod(&q, &r, &dvd, &dvs);
ok = ok && IntToU64(&q) == 1000003u / 101u && IntToU64(&r) == 1000003u % 101u;
IntDeinit(&dvd);- In
Math.c:3845:
bool ok = IntDivMod(&q, &r, &dvd, &dvs);
ok = ok && IntIsZero(&q) && IntToU64(&r) == 50u;
IntDeinit(&dvd);- In
Math.c:3865:
bool ok = IntDiv(&r, &dvd, &dvs); // int_div frees remainder on success (1445)
ok = ok && IntToU64(&r) == 1000003u / 101u;
IntDeinit(&dvd);- In
Math.c:3884:
bool ok = IntDivExact(&r, &dvd, &dvs); // frees remainder on success (1474)
ok = ok && IntToU64(&r) == 125u;
IntDeinit(&dvd);- In
Math.c:3908:
ok = ok && IntDivExact(&r2, &dvd, 8u);
ok = ok && IntDiv(&r3, &dvd, (i64)8);
ok = ok && IntToU64(&r1) == 125u && IntToU64(&r2) == 125u && IntToU64(&r3) == 125u;
IntDeinit(&dvd);- In
Math.c:3934:
ok = ok && IntMod(&m1, &dvd, 100u);
ok = ok && IntMod(&m2, &dvd, (i64)100);
ok = ok && IntToU64(&q) == 10u && IntToU64(&r) == 3u;
ok = ok && IntToU64(&m1) == 3u && IntToU64(&m2) == 3u;- In
Math.c:3935:
ok = ok && IntMod(&m2, &dvd, (i64)100);
ok = ok && IntToU64(&q) == 10u && IntToU64(&r) == 3u;
ok = ok && IntToU64(&m1) == 3u && IntToU64(&m2) == 3u;
IntDeinit(&dvd);- In
Math.c:3956:
bool ok = IntMod(&r, &dvd, &dvs); // int_mod frees quotient on success (1598)
ok = ok && IntToU64(&r) == 3u;
IntDeinit(&dvd);- In
Math.c:3976:
bool ok = IntPow(&r, &base, 13u);
ok = ok && IntToU64(&r) == 1594323u; // 3^13
IntDeinit(&base);- In
Math.c:3995:
bool ok = IntGCD(&r, &x, &y);
ok = ok && IntToU64(&r) == 6u;
IntDeinit(&x);- In
Math.c:4015:
bool ok = IntLCM(&r, &x, &y);
ok = ok && IntToU64(&r) == 42u;
IntDeinit(&x);- In
Math.c:4036:
bool ok = IntRootRem(&root, &rem, &v, 3); // 100^3 = 1e6
ok = ok && IntToU64(&root) == 100u && IntIsZero(&rem);
IntDeinit(&v);- In
Math.c:4056:
bool ok = IntRootRem(&root, &rem, &v, 3); // cbrt(1000)=10 exact actually
ok = ok && IntToU64(&root) == 10u && IntIsZero(&rem);
// and a genuinely inexact one
- In
Math.c:4061:
Int v2 = IntFrom(999u, a);
ok = ok && IntRootRem(&root, &rem, &v2, 3);
ok = ok && IntToU64(&root) == 9u && IntToU64(&rem) == 999u - 729u;
IntDeinit(&v);- In
Math.c:4080:
bool ok = IntRoot(&r, &v, 3); // frees remainder on success (1877)
ok = ok && IntToU64(&r) == 100u;
IntDeinit(&v);- In
Math.c:4160:
bool ok = IntModAdd(&r, &x, &y, &m); // frees ar/br/sum on success (2042-2044)
ok = ok && IntToU64(&r) == (12345u % 1009u + 67890u % 1009u) % 1009u;
IntDeinit(&x);- In
Math.c:4182:
bool ok = IntModSub(&r, &x, &y, &m);
ok = ok && IntToU64(&r) == 800u;
IntDeinit(&x);- In
Math.c:4204:
bool ok = IntModSub(&r, &x, &y, &m);
ok = ok && IntToU64(&r) == 1009u - 800u;
IntDeinit(&x);- In
Math.c:4252:
bool ok = IntModMul(&r, &x, &y, &m); // frees ar/br/prod (2126-2128)
ok = ok && IntToU64(&r) == (12345ull * 67890ull) % 1009ull;
IntDeinit(&x);- In
Math.c:4272:
bool ok = IntSquareMod(&r, &x, &m);
ok = ok && IntToU64(&r) == (12345ull * 12345ull) % 1009ull;
IntDeinit(&x);- In
Math.c:4314:
bool ok = IntPowMod(&r, &base, 13u, &m);
ok = ok && IntToU64(&r) == 96889010407ull % 1000000007ull; // 7^13 mod m
IntDeinit(&base);- In
Math.c:4335:
bool ok = IntPowMod(&r, &base, &exp, &m);
ok = ok && IntToU64(&r) == 96889010407ull % 1000000007ull;
IntDeinit(&base);- In
Math.c:4355:
bool ok = IntModInv(&r, &v, &m);
ok = ok && (IntToU64(&r) * 17u) % 3120u == 1u;
IntDeinit(&v);- In
Math.c:4377:
bool ok = IntModInv(&r, &v, &m);
ok = ok && IntToU64(&r) == 5u;
IntDeinit(&v);- In
Math.c:4418:
bool ok = IntModSqrt(&r, &v, &m);
u64 rv = IntToU64(&r);
ok = ok && (rv * rv) % 7u == 2u;- In
Math.c:4441:
bool ok = IntModSqrt(&r, &v, &m);
u64 rv = IntToU64(&r);
ok = ok && (rv * rv) % 17u == 2u;- In
Math.c:4463:
bool ok = IntModSqrt(&r, &v, &m);
u64 rv = IntToU64(&r);
ok = ok && (rv * rv) % 41u == 10u;- In
Math.c:4503:
Int r = IntFrom(9u, a);
bool ok = IntModSqrt(&r, &v, &m) && IntToU64(&r) == 1u;
IntDeinit(&v);- In
Math.c:4618:
bool ok = IntNextPrime(&r, &v);
ok = ok && IntToU64(&r) == 1000003u;
IntDeinit(&v);- In
Math.c:4638:
Int r1 = IntFrom(7u, a);
bool ok = IntNextPrime(&r0, &v0) && IntToU64(&r0) == 2u;
ok = ok && IntNextPrime(&r1, &v1) && IntToU64(&r1) == 3u;- In
Math.c:4639:
bool ok = IntNextPrime(&r0, &v0) && IntToU64(&r0) == 2u;
ok = ok && IntNextPrime(&r1, &v1) && IntToU64(&r1) == 3u;
IntDeinit(&v0);- In
Math.c:4659:
bool ok = IntMul(&r, &x, &y);
ok = ok && IntToU64(&r) == 123456ull * 7891011ull;
IntDeinit(&x);- In
Math.c:4677:
bool ok = IntDivExact(&r, &dvd, (i64)8);
ok = ok && IntToU64(&r) == 125u;
IntDeinit(&dvd);- In
Math.c:4709:
bool found = IntModSqrt(&r, &v, &m);
if (found) {
u64 rv = IntToU64(&r);
ok = ok && (rv * rv) % p == vv;
}- In
Convert.c:102:
bool result = IntBitLength(&value) == 4;
result = result && (IntToU64(&value) == 13);
result = result && (ZstrCompare(StrBegin(&text), "1101") == 0);- In
Convert.c:161:
Str text = IntToBinary(&value);
bool result = IntToU64(&value) == 11;
result = result && (ZstrCompare(StrBegin(&text), "1011") == 0);- In
Convert.c:195:
Str text = IntToStrRadix(&value, 36, false);
bool result = IntToU64(&value) == 1295;
result = result && (ZstrCompare(StrBegin(&text), "zz") == 0);- In
Convert.c:275:
bool result = IntBitLength(&zero) == 0;
result = result && IntIsZero(&zero);
result = result && (IntToU64(&zero, &error) == 0);
result = result && !error;
result = result && (ZstrCompare(StrBegin(&text), "0") == 0);- In
Convert.c:292:
Int value = IntFromBinary("0b1010_0011", ALLOCATOR_OF(&alloc));
bool result = IntToU64(&value) == 163;
result = result && (IntBitLength(&value) == 8);- In
Convert.c:308:
Str text = IntToOctStr(&value);
bool result = IntToU64(&value) == 493;
result = result && (ZstrCompare(StrBegin(&text), "755") == 0);- In
Convert.c:425:
bool test_int_to_u64_overflow(void) {
WriteFmt("Testing IntToU64 overflow handling\n");
DefaultAllocator alloc = DefaultAllocatorInit();- In
Convert.c:436:
bool result = !IntTryToU64(&value, &out);
result = result && (IntToU64(&value, &error) == 0);
result = result && error;
result = result && (out == 0);- In
Convert.c:622:
bool ok = IntMul(&product, &a, &b);
bool result = ok && (IntToU64(&product) == (u64)273u);
/* 273 = 0b100010001, 9 significant bits */
result = result && (IntBitLength(&product) == 9);- In
Convert.c:670:
Int value = IntInit(ALLOCATOR_OF(&alloc));
bool ok = IntTryFromStrRadix(&value, "7", 10);
bool result = ok && (IntToU64(&value) == 7);
IntDeinit(&value);- In
Convert.c:696:
bool rejected_radix = !IntTryFromStrRadix(&invalid, "5", 37);
bool result = ok_valid && (IntToU64(&valid) == 5);
result = result && rejected_radix;
result = result && IntIsZero(&invalid);- In
Convert.c:734:
Int out = IntInit(&alloc.base);
bool ok = int_try_from_binary_str(&out, &text);
bool result = ok && (IntToU64(&out) == 5u);
StrDeinit(&text);- In
Convert.c:761:
Int out = IntInit(&alloc.base);
bool ok = int_try_from_binary_str(&out, &text);
bool result = ok && (IntToU64(&out) == 5u);
StrDeinit(&text);- In
Convert.c:788:
Int out = IntInit(&alloc.base);
bool ok = int_try_from_binary_str(&out, &text);
bool result = ok && (IntToU64(&out) == 13u);
StrDeinit(&text);- In
Convert.c:822:
Int out = IntInit(&alloc.base);
bool ok = int_try_from_oct_str_str(&out, &text);
bool result = ok && (IntToU64(&out) == 15u);
StrDeinit(&text);- In
Convert.c:848:
Int out = IntInit(&alloc.base);
bool ok = int_try_from_oct_str_str(&out, &text);
bool result = ok && (IntToU64(&out) == 15u);
StrDeinit(&text);- In
Convert.c:873:
Int out = IntInit(&alloc.base);
bool ok = int_try_from_oct_str_str(&out, &text);
bool result = ok && (IntToU64(&out) == 15u);
StrDeinit(&text);- In
Convert.c:961:
bool parsed = IntTryFromStrRadix(&out, "AZ", 36);
bool result = parsed && (IntToU64(&out) == 395);
IntDeinit(&out);- In
Convert.c:984:
bool parsed = IntTryFromStrRadix(&out, "FF", 16);
bool result = parsed && (IntToU64(&out) == 255);
IntDeinit(&out);- In
Convert.c:1008:
bool parsed = IntTryFromStr(&out, &text);
bool result = parsed && (IntToU64(&out) == 123);
IntDeinit(&out);- In
Convert.c:1039:
bool parsed = IntTryFromStr(&out, &text);
bool result = parsed && (IntToU64(&out) == 5);
IntDeinit(&out);- In
Convert.c:1064:
bool result = ok;
result = result && (IntToU64(&value) == 123);
IntDeinit(&value);- In
Convert.c:1092:
bool result = ok;
result = result && (IntToU64(&value) == 5);
IntDeinit(&value);- In
Convert.c:1215:
bool ok = IntTryFromStr(&out, text);
bool result = ok;
result = result && (IntToU64(&out) == 5u);
IntDeinit(&out);- In
Convert.c:1235:
bool ok = IntTryFromStr(&out, text);
bool result = ok;
result = result && (IntToU64(&out) == 42u);
IntDeinit(&out);- In
Convert.c:1253:
bool ok = IntTryFromStrRadix(&out, "+5", (u8)10);
bool result = ok && (IntToU64(&out) == 5);
IntDeinit(&out);- In
Convert.c:1271:
bool ok = IntTryFromOctStr(&out, "17");
bool result = ok && (IntToU64(&out) == 15);
IntDeinit(&out);- In
Convert.c:1290:
bool ok = IntTryFromOctStr(&out, "017");
bool result = ok && (IntToU64(&out) == 15);
IntDeinit(&out);- In
Convert.c:1438:
Int value = IntFromBytesLE(bytes, sizeof(bytes), ALLOCATOR_OF(&alloc));
bool result = (IntToU64(&value) == 5);
result = result && (IntBitLength(&value) == 3);- In
Convert.c:1460:
Int value = IntFromStr(&digits, &alloc.base);
bool result = (IntToU64(&value) == (u64)12345u);
IntDeinit(&value);- In
Convert.c:1481:
Int value = IntFromStrRadix(&digits, (u8)16u, &alloc.base);
bool result = (IntToU64(&value) == (u64)255u);
IntDeinit(&value);- In
Convert.c:1508:
bool result = ok;
result = result && (IntToU64(&value) == 255u);
StrDeinit(&hex);- In
Convert.c:1597:
Int v = IntFromBytesBE(bytes, sizeof(bytes), &dbg);
bool ok = IntToU64(&v) == 0x01020304u;
IntDeinit(&v);- In
Convert.c:1612:
bool ok = IntTryFromStr(&out, "123456789");
ok = ok && IntToU64(&out) == 123456789u;
IntDeinit(&out);- In
Access.c:216:
bool ok = IntRootRem(&root, &remainder, &value, 1);
bool result = ok;
result = result && (IntToU64(&root) == 12345);
result = result && (IntCompare(&remainder, 0) == 0);- In
Access.c:278:
bool ok = IntShiftRight(&value, 0);
bool result = ok && (IntToU64(&value) == 5);
IntDeinit(&value);- In
Access.c:361:
bool ok = IntPowMod(&result_value, &base, 20u, &mod);
bool result = ok && (IntToU64(&result_value) == 3);
IntDeinit(&base);
Last updated on