IntFrom
Description
Convert a native integer into an arbitrary-precision integer. Dispatches on the type of value.
Aborts when a signed input is negative.
Parameters
| Name | Direction | Description |
|---|---|---|
value |
in | Signed or unsigned integer source value |
Usage example (from documentation)
Int value = IntFrom(1234u);Success
Returns Integer holding the same non-negative value.
Failure
LOG_FATAL when a signed value is negative (the non-negative IntFrom contract is violated). Allocator failures on the underlying construction abort through the allocator’s standard failure path.
Usage example (Cross-references)
Usage examples (Cross-references)
- In
Compare.c:133:
Float value = FloatFromStr("12.5", &alloc.base);
Float same = FloatFromStr("12.5", &alloc.base);
Int whole = IntFrom(12, &alloc.base);
Int next = IntFrom(13, &alloc.base);- In
Compare.c:134:
Float same = FloatFromStr("12.5", &alloc.base);
Int whole = IntFrom(12, &alloc.base);
Int next = IntFrom(13, &alloc.base);
bool result = (FloatCompare(&value, &same) == 0);- In
Compare.c:289:
Float v = FloatFromStr("3", &alloc.base);
Int i3 = IntFrom(3, &alloc.base);
bool err = true;
bool ok = true;- In
Compare.c:525:
Float lhs = FloatFromStr("7", &alloc.base);
Int less = IntFrom(3, &alloc.base);
Int same = IntFrom(7, &alloc.base);
Int more = IntFrom(9, &alloc.base);- In
Compare.c:526:
Float lhs = FloatFromStr("7", &alloc.base);
Int less = IntFrom(3, &alloc.base);
Int same = IntFrom(7, &alloc.base);
Int more = IntFrom(9, &alloc.base);- In
Compare.c:527:
Int less = IntFrom(3, &alloc.base);
Int same = IntFrom(7, &alloc.base);
Int more = IntFrom(9, &alloc.base);
bool error = true;- In
Compare.c:742:
DebugAllocator dbg = DebugAllocatorInitWith(LEAK_CFG);
Float a = FloatFromStr("3.5", &dbg.base);
Int b = IntFrom(3, &dbg.base);
int cmp = FloatCompare(&a, &b);- In
Math.c:148:
Float a = FloatFromStr("1.25", &alloc.base);
Float b = FloatFromStr("0.75", &alloc.base);
Int whole = IntFrom(2, &alloc.base);
Float result_value = FloatInit(&alloc.base);
Str text = StrInit(&alloc.base);- In
Math.c:243:
Float a = FloatFromStr("5.5", &alloc.base);
Float b = FloatFromStr("0.5", &alloc.base);
Int whole = IntFrom(2, &alloc.base);
Float result_value = FloatInit(&alloc.base);
Str text = StrInit(&alloc.base);- In
Math.c:333:
Float a = FloatFromStr("1.5", &alloc.base);
Float b = FloatFromStr("2", &alloc.base);
Int whole = IntFrom(2, &alloc.base);
Float result_value = FloatInit(&alloc.base);
Str text = StrInit(&alloc.base);- In
Math.c:423:
Float a = FloatFromStr("7.5", &alloc.base);
Float b = FloatFromStr("2.5", &alloc.base);
Int whole = IntFrom(3, &alloc.base);
Float result_value = FloatInit(&alloc.base);
Str text = StrInit(&alloc.base);- In
Math.c:800:
Float a = FloatFromStr("6", &alloc.base);
Float result = FloatInit(&alloc.base);
Int zero = IntFrom(0u, &alloc.base);
// Real float_div rejects division by zero -> false.
- In
Math.c:1139:
Float a = FloatFromStr("1.5", &dbg.base);
Float r = FloatInit(&dbg.base);
Int b = IntFrom(2, &dbg.base);
bool ok = FloatAdd(&r, &a, &b);- In
Math.c:1233:
Float a = FloatFromStr("5.5", &dbg.base);
Float r = FloatInit(&dbg.base);
Int b = IntFrom(2, &dbg.base);
bool ok = FloatSub(&r, &a, &b);- In
Math.c:1310:
Float a = FloatFromStr("1.5", &dbg.base);
Float r = FloatInit(&dbg.base);
Int b = IntFrom(4, &dbg.base);
bool ok = FloatMul(&r, &a, &b);- In
Math.c:1387:
Float a = FloatFromStr("1", &dbg.base);
Float r = FloatInit(&dbg.base);
Int b = IntFrom(4, &dbg.base);
bool ok = FloatDiv(&r, &a, &b, 6u);- In
Convert.c:126:
Float value = FloatFromStr("123.45", ALLOCATOR_OF(&alloc));
Int result_value = IntFrom(99, ALLOCATOR_OF(&alloc));
bool result = !FloatToInt(&result_value, &value);- In
Convert.c:143:
Float value = FloatFromStr("-42", ALLOCATOR_OF(&alloc));
Int result_value = IntFrom(99, ALLOCATOR_OF(&alloc));
bool result = !FloatToInt(&result_value, &value);- In
Convert.c:310:
DefaultAllocator alloc = DefaultAllocatorInit();
Int whole = IntFrom(100, &alloc.base);
Float value = FloatFrom(&whole, &alloc.base);- In
Convert.c:330:
DefaultAllocator alloc = DefaultAllocatorInit();
Int whole = IntFrom(100, &alloc.base);
Float value = FloatFrom(&whole, &alloc.base);
Str text = FloatToStr(&value);- In
Convert.c:352:
DefaultAllocator alloc = DefaultAllocatorInit();
Int whole = IntFrom(2000, &alloc.base);
Float value = FloatFrom(&whole, &alloc.base);- In
Convert.c:736:
Float v = FloatFromStr("12e4", &dbg.base); // significand 12, exp 4
Int r = IntFrom(999999999u, &dbg.base); // pre-populated dest
bool ok = FloatToInt(&r, &v);- In
Convert.c:758:
Float v = FloatFromStr("150e-1", &dbg.base); // 15.0, exact integer 15
Int r = IntFrom(777u, &dbg.base); // pre-populated dest
bool ok = FloatToInt(&r, &v);- In
Convert.c:784:
Float v = FloatFromStr("1.5", &dbg.base); // significand 15, exponent -1
Int r = IntFrom(777u, &dbg.base); // pre-populated dest
// Non-integer -> FloatToInt returns false, but the negative-exponent block
- In
Convert.c:806:
Float v = FloatFrom(0u, &dbg.base);
Int r = IntFrom(424242u, &dbg.base); // pre-populated dest
bool ok = FloatToInt(&r, &v);- In
Compare.c:26:
DefaultAllocator alloc = DefaultAllocatorInit();
Int a = IntFrom(41, &alloc.base);
Int b = IntFrom(42, &alloc.base);
Int c = IntFromBinary("000101010", &alloc.base);- In
Compare.c:27:
Int a = IntFrom(41, &alloc.base);
Int b = IntFrom(42, &alloc.base);
Int c = IntFromBinary("000101010", &alloc.base);- In
Compare.c:46:
DefaultAllocator alloc = DefaultAllocatorInit();
Int a = IntFrom(41, &alloc.base);
Int b = IntFrom(42, &alloc.base);
Int c = IntFromBinary("000101010", &alloc.base);- In
Compare.c:47:
Int a = IntFrom(41, &alloc.base);
Int b = IntFrom(42, &alloc.base);
Int c = IntFromBinary("000101010", &alloc.base);- In
Compare.c:71:
DefaultAllocator alloc = DefaultAllocatorInit();
Int value = IntFrom(42, &alloc.base);
Int same = IntFromBinary("00101010", &alloc.base);
Int big = IntFrom(1, &alloc.base);- In
Compare.c:73:
Int value = IntFrom(42, &alloc.base);
Int same = IntFromBinary("00101010", &alloc.base);
Int big = IntFrom(1, &alloc.base);
IntShiftLeft(&big, 80);- In
Compare.c:102:
DefaultAllocator alloc = DefaultAllocatorInit();
Int a = IntFrom(42u, &alloc.base);
Int b = IntFromBinary("101010", &alloc.base);
Int c = IntFrom(0u, &alloc.base);- In
Compare.c:104:
Int a = IntFrom(42u, &alloc.base);
Int b = IntFromBinary("101010", &alloc.base);
Int c = IntFrom(0u, &alloc.base);
Int d = IntFrom(0u, &alloc.base);- In
Compare.c:105:
Int b = IntFromBinary("101010", &alloc.base);
Int c = IntFrom(0u, &alloc.base);
Int d = IntFrom(0u, &alloc.base);
bool result = (int_hash(&a, 0) == int_hash(&b, 0));- In
Compare.c:126:
DefaultAllocator alloc = DefaultAllocatorInit();
Int zero = IntFrom(0u, &alloc.base);
Int one = IntFrom(1u, &alloc.base);
Int small = IntFrom(42u, &alloc.base);- In
Compare.c:127:
Int zero = IntFrom(0u, &alloc.base);
Int one = IntFrom(1u, &alloc.base);
Int small = IntFrom(42u, &alloc.base);
Int large = IntFrom(1u, &alloc.base);- In
Compare.c:128:
Int zero = IntFrom(0u, &alloc.base);
Int one = IntFrom(1u, &alloc.base);
Int small = IntFrom(42u, &alloc.base);
Int large = IntFrom(1u, &alloc.base);
IntShiftLeft(&large, 80);- In
Compare.c:129:
Int one = IntFrom(1u, &alloc.base);
Int small = IntFrom(42u, &alloc.base);
Int large = IntFrom(1u, &alloc.base);
IntShiftLeft(&large, 80);
Int decimal = IntFromStr("12345678901234567890", &alloc.base);- In
Compare.c:163:
Map(Int, u64) counts = MapInit(int_hash, int_compare, &alloc);
Int k1 = IntFrom(100u, &alloc.base);
Int k2 = IntFrom(200u, &alloc.base);
Int k3 = IntFrom(100u, &alloc.base); // duplicate of k1 by value
- In
Compare.c:164:
Int k1 = IntFrom(100u, &alloc.base);
Int k2 = IntFrom(200u, &alloc.base);
Int k3 = IntFrom(100u, &alloc.base); // duplicate of k1 by value
- In
Compare.c:165:
Int k1 = IntFrom(100u, &alloc.base);
Int k2 = IntFrom(200u, &alloc.base);
Int k3 = IntFrom(100u, &alloc.base); // duplicate of k1 by value
MapInsertR(&counts, k1, 1u);- In
Compare.c:170:
MapInsertR(&counts, k2, 2u);
Int probe = IntFrom(100u, &alloc.base);
u64 *got = MapGetFirstPtr(&counts, probe);
Int missing = IntFrom(999u, &alloc.base);- In
Compare.c:172:
Int probe = IntFrom(100u, &alloc.base);
u64 *got = MapGetFirstPtr(&counts, probe);
Int missing = IntFrom(999u, &alloc.base);
u64 *gone = MapGetFirstPtr(&counts, missing);- In
Compare.c:205:
DefaultAllocator alloc = DefaultAllocatorInit();
Int lhs = IntFrom(0x8000000000000000u, &alloc.base);
bool fail = (IntBitLength(&lhs) != 64); // sanity: exactly 64 bits.
- In
Compare.c:222:
DefaultAllocator alloc = DefaultAllocatorInit();
Int lhs = IntFrom(7u, &alloc.base);
bool fail = (IntCompare(&lhs, 9u) != -1);- In
Compare.c:242:
DefaultAllocator alloc = DefaultAllocatorInit();
Int one = IntFrom(1, &alloc.base);
bool result = (IntIsOne(&one) == true);- In
Compare.c:269:
/* A non-zero lhs vs rhs 0 must still report greater (positive). */
Int five = IntFrom((u64)5u, &alloc.base);
result = result && (int_compare_i64(&five, (i64)0) > 0);- In
Type.c:119:
DefaultAllocator alloc = DefaultAllocatorInit();
Int a = IntFrom(255, &alloc.base);
Int b = IntFrom(1, &alloc.base);
Int sum = IntInit(&alloc.base);- In
Type.c:120:
Int a = IntFrom(255, &alloc.base);
Int b = IntFrom(1, &alloc.base);
Int sum = IntInit(&alloc.base);- In
Type.c:146:
DefaultAllocator alloc = DefaultAllocatorInit();
Int v255 = IntFrom(255, &alloc.base);
bool result = IntBitLength(&v255) == 8;- In
Math.c:77:
DefaultAllocator alloc = DefaultAllocatorInit();
Int value = IntFrom(3, &alloc.base);
IntShiftLeft(&value, 4);- In
Math.c:111:
DefaultAllocator alloc = DefaultAllocatorInit();
Int a = IntFrom(255, &alloc.base);
Int b = IntFrom(1, &alloc.base);
Int result_value = IntInit(&alloc.base);- In
Math.c:112:
Int a = IntFrom(255, &alloc.base);
Int b = IntFrom(1, &alloc.base);
Int result_value = IntInit(&alloc.base);
Str text = StrInit(&alloc.base);- In
Math.c:135:
DefaultAllocator alloc = DefaultAllocatorInit();
Int base = IntFrom(40, &alloc.base);
Int rhs = IntFrom(2, &alloc.base);
Int result_value = IntInit(&alloc.base);- In
Math.c:136:
Int base = IntFrom(40, &alloc.base);
Int rhs = IntFrom(2, &alloc.base);
Int result_value = IntInit(&alloc.base);
Int huge = IntFromStr("123456789012345678901234567890", &alloc.base);- In
Math.c:168:
DefaultAllocator alloc = DefaultAllocatorInit();
Int a = IntFrom(256, &alloc.base);
Int b = IntFrom(1, &alloc.base);
Int result_value = IntInit(&alloc.base);- In
Math.c:169:
Int a = IntFrom(256, &alloc.base);
Int b = IntFrom(1, &alloc.base);
Int result_value = IntInit(&alloc.base);- In
Math.c:187:
DefaultAllocator alloc = DefaultAllocatorInit();
Int base = IntFrom(40, &alloc.base);
Int rhs = IntFrom(2, &alloc.base);
Int result_value = IntInit(&alloc.base);- In
Math.c:188:
Int base = IntFrom(40, &alloc.base);
Int rhs = IntFrom(2, &alloc.base);
Int result_value = IntInit(&alloc.base);
Int preserved = IntFrom(99, &alloc.base);- In
Math.c:190:
Int rhs = IntFrom(2, &alloc.base);
Int result_value = IntInit(&alloc.base);
Int preserved = IntFrom(99, &alloc.base);
Int huge = IntFromStr("12345678901234567890", &alloc.base);
Str text = StrInit(&alloc.base);- In
Math.c:225:
DefaultAllocator alloc = DefaultAllocatorInit();
Int a = IntFrom(3, &alloc.base);
Int b = IntFrom(5, &alloc.base);
Int result_value = IntFrom(99, &alloc.base);- In
Math.c:226:
Int a = IntFrom(3, &alloc.base);
Int b = IntFrom(5, &alloc.base);
Int result_value = IntFrom(99, &alloc.base);- In
Math.c:227:
Int a = IntFrom(3, &alloc.base);
Int b = IntFrom(5, &alloc.base);
Int result_value = IntFrom(99, &alloc.base);
bool result = !IntSub(&result_value, &a, &b);- In
Math.c:244:
DefaultAllocator alloc = DefaultAllocatorInit();
Int a = IntFrom(21, &alloc.base);
Int b = IntFrom(6, &alloc.base);
Int result_value = IntInit(&alloc.base);- In
Math.c:245:
Int a = IntFrom(21, &alloc.base);
Int b = IntFrom(6, &alloc.base);
Int result_value = IntInit(&alloc.base);- In
Math.c:285:
DefaultAllocator alloc = DefaultAllocatorInit();
Int a = IntFrom(0, &alloc.base);
Int b = IntFrom(12345, &alloc.base);
Int result_value = IntInit(&alloc.base);- In
Math.c:286:
Int a = IntFrom(0, &alloc.base);
Int b = IntFrom(12345, &alloc.base);
Int result_value = IntInit(&alloc.base);- In
Math.c:306:
DefaultAllocator alloc = DefaultAllocatorInit();
Int value = IntFrom(12345, &alloc.base);
Int result_value = IntInit(&alloc.base);- In
Math.c:324:
DefaultAllocator alloc = DefaultAllocatorInit();
Int base = IntFrom(7, &alloc.base);
Int exponent = IntFrom(20, &alloc.base);
Int result_value = IntInit(&alloc.base);- In
Math.c:325:
Int base = IntFrom(7, &alloc.base);
Int exponent = IntFrom(20, &alloc.base);
Int result_value = IntInit(&alloc.base);
Str text = StrInit(&alloc.base);- In
Math.c:375:
DefaultAllocator alloc = DefaultAllocatorInit();
Int dividend = IntFrom(126, &alloc.base);
Int result_value = IntInit(&alloc.base);- In
Math.c:413:
DefaultAllocator alloc = DefaultAllocatorInit();
Int dividend = IntFrom(10, &alloc.base);
Int divisor = IntFrom(3, &alloc.base);
Int result_value = IntFrom(99, &alloc.base);- In
Math.c:414:
Int dividend = IntFrom(10, &alloc.base);
Int divisor = IntFrom(3, &alloc.base);
Int result_value = IntFrom(99, &alloc.base);- In
Math.c:415:
Int dividend = IntFrom(10, &alloc.base);
Int divisor = IntFrom(3, &alloc.base);
Int result_value = IntFrom(99, &alloc.base);
bool result = !IntDivExact(&result_value, ÷nd, &divisor);- In
Math.c:456:
DefaultAllocator alloc = DefaultAllocatorInit();
Int dividend = IntFrom(126, &alloc.base);
Int result_value = IntInit(&alloc.base);- In
Math.c:491:
DefaultAllocator alloc = DefaultAllocatorInit();
Int a = IntFrom(48, &alloc.base);
Int b = IntFrom(18, &alloc.base);
Int result_value = IntInit(&alloc.base);- In
Math.c:492:
Int a = IntFrom(48, &alloc.base);
Int b = IntFrom(18, &alloc.base);
Int result_value = IntInit(&alloc.base);- In
Math.c:511:
DefaultAllocator alloc = DefaultAllocatorInit();
Int a = IntFrom(21, &alloc.base);
Int b = IntFrom(6, &alloc.base);
Int result_value = IntInit(&alloc.base);- In
Math.c:512:
Int a = IntFrom(21, &alloc.base);
Int b = IntFrom(6, &alloc.base);
Int result_value = IntInit(&alloc.base);- In
Math.c:531:
DefaultAllocator alloc = DefaultAllocatorInit();
Int value = IntFrom(4096, &alloc.base);
Int result_value = IntInit(&alloc.base);- In
Math.c:549:
DefaultAllocator alloc = DefaultAllocatorInit();
Int value = IntFrom(200, &alloc.base);
Int root = IntInit(&alloc.base);
Int remainder = IntInit(&alloc.base);- In
Math.c:570:
DefaultAllocator alloc = DefaultAllocatorInit();
Int value = IntFrom(200, &alloc.base);
Int result_value = IntInit(&alloc.base);- In
Math.c:588:
DefaultAllocator alloc = DefaultAllocatorInit();
Int value = IntFrom(200, &alloc.base);
Int root = IntInit(&alloc.base);
Int remainder = IntInit(&alloc.base);- In
Math.c:609:
DefaultAllocator alloc = DefaultAllocatorInit();
Int square = IntFrom(144, &alloc.base);
Int non_square = IntFrom(145, &alloc.base);- In
Math.c:610:
Int square = IntFrom(144, &alloc.base);
Int non_square = IntFrom(145, &alloc.base);
bool result = IntIsPerfectSquare(&square);- In
Math.c:626:
DefaultAllocator alloc = DefaultAllocatorInit();
Int power = IntFrom(81, &alloc.base);
Int non_power = IntFrom(82, &alloc.base);
Int one = IntFrom(1, &alloc.base);- In
Math.c:627:
Int power = IntFrom(81, &alloc.base);
Int non_power = IntFrom(82, &alloc.base);
Int one = IntFrom(1, &alloc.base);- In
Math.c:628:
Int power = IntFrom(81, &alloc.base);
Int non_power = IntFrom(82, &alloc.base);
Int one = IntFrom(1, &alloc.base);
bool result = IntIsPerfectPower(&power);- In
Math.c:646:
DefaultAllocator alloc = DefaultAllocatorInit();
Int a = IntFrom(5, &alloc.base);
Int p = IntFrom(7, &alloc.base);
Int b = IntFrom(9, &alloc.base);- In
Math.c:647:
Int a = IntFrom(5, &alloc.base);
Int p = IntFrom(7, &alloc.base);
Int b = IntFrom(9, &alloc.base);
Int n = IntFrom(21, &alloc.base);- In
Math.c:648:
Int a = IntFrom(5, &alloc.base);
Int p = IntFrom(7, &alloc.base);
Int b = IntFrom(9, &alloc.base);
Int n = IntFrom(21, &alloc.base);- In
Math.c:649:
Int p = IntFrom(7, &alloc.base);
Int b = IntFrom(9, &alloc.base);
Int n = IntFrom(21, &alloc.base);
bool result = IntJacobi(&a, &p) == -1;- In
Math.c:667:
DefaultAllocator alloc = DefaultAllocatorInit();
Int value = IntFrom(12345, &alloc.base);
Int mod = IntFrom(97, &alloc.base);
Int result_value = IntInit(&alloc.base);- In
Math.c:668:
Int value = IntFrom(12345, &alloc.base);
Int mod = IntFrom(97, &alloc.base);
Int result_value = IntInit(&alloc.base);- In
Math.c:687:
DefaultAllocator alloc = DefaultAllocatorInit();
Int a = IntFrom(100, &alloc.base);
Int b = IntFrom(250, &alloc.base);
Int m = IntFrom(13, &alloc.base);- In
Math.c:688:
Int a = IntFrom(100, &alloc.base);
Int b = IntFrom(250, &alloc.base);
Int m = IntFrom(13, &alloc.base);
Int result_value = IntInit(&alloc.base);- In
Math.c:689:
Int a = IntFrom(100, &alloc.base);
Int b = IntFrom(250, &alloc.base);
Int m = IntFrom(13, &alloc.base);
Int result_value = IntInit(&alloc.base);- In
Math.c:709:
DefaultAllocator alloc = DefaultAllocatorInit();
Int a = IntFrom(5, &alloc.base);
Int b = IntFrom(9, &alloc.base);
Int m = IntFrom(13, &alloc.base);- In
Math.c:710:
Int a = IntFrom(5, &alloc.base);
Int b = IntFrom(9, &alloc.base);
Int m = IntFrom(13, &alloc.base);
Int result_value = IntInit(&alloc.base);- In
Math.c:711:
Int a = IntFrom(5, &alloc.base);
Int b = IntFrom(9, &alloc.base);
Int m = IntFrom(13, &alloc.base);
Int result_value = IntInit(&alloc.base);- In
Math.c:731:
DefaultAllocator alloc = DefaultAllocatorInit();
Int a = IntFrom(123, &alloc.base);
Int b = IntFrom(456, &alloc.base);
Int m = IntFrom(97, &alloc.base);- In
Math.c:732:
Int a = IntFrom(123, &alloc.base);
Int b = IntFrom(456, &alloc.base);
Int m = IntFrom(97, &alloc.base);
Int result_value = IntInit(&alloc.base);- In
Math.c:733:
Int a = IntFrom(123, &alloc.base);
Int b = IntFrom(456, &alloc.base);
Int m = IntFrom(97, &alloc.base);
Int result_value = IntInit(&alloc.base);- In
Math.c:753:
DefaultAllocator alloc = DefaultAllocatorInit();
Int a = IntFrom(10, &alloc.base);
Int b = IntFrom(3, &alloc.base);
Int m = IntFrom(13, &alloc.base);- In
Math.c:754:
Int a = IntFrom(10, &alloc.base);
Int b = IntFrom(3, &alloc.base);
Int m = IntFrom(13, &alloc.base);
Int result_value = IntInit(&alloc.base);- In
Math.c:755:
Int a = IntFrom(10, &alloc.base);
Int b = IntFrom(3, &alloc.base);
Int m = IntFrom(13, &alloc.base);
Int result_value = IntInit(&alloc.base);
Int check = IntInit(&alloc.base);- In
Math.c:779:
DefaultAllocator alloc = DefaultAllocatorInit();
Int base = IntFrom(7, &alloc.base);
Int mod = IntFrom(13, &alloc.base);
Int result_value = IntInit(&alloc.base);- In
Math.c:780:
Int base = IntFrom(7, &alloc.base);
Int mod = IntFrom(13, &alloc.base);
Int result_value = IntInit(&alloc.base);- In
Math.c:799:
DefaultAllocator alloc = DefaultAllocatorInit();
Int base = IntFrom(4, &alloc.base);
Int exp = IntFrom(13, &alloc.base);
Int mod = IntFrom(497, &alloc.base);- In
Math.c:800:
Int base = IntFrom(4, &alloc.base);
Int exp = IntFrom(13, &alloc.base);
Int mod = IntFrom(497, &alloc.base);
Int result_value = IntInit(&alloc.base);- In
Math.c:801:
Int base = IntFrom(4, &alloc.base);
Int exp = IntFrom(13, &alloc.base);
Int mod = IntFrom(497, &alloc.base);
Int result_value = IntInit(&alloc.base);- In
Math.c:821:
DefaultAllocator alloc = DefaultAllocatorInit();
Int value = IntFrom(3, &alloc.base);
Int mod = IntFrom(11, &alloc.base);
Int result_value = IntInit(&alloc.base);- In
Math.c:822:
Int value = IntFrom(3, &alloc.base);
Int mod = IntFrom(11, &alloc.base);
Int result_value = IntInit(&alloc.base);
Int check = IntInit(&alloc.base);- In
Math.c:845:
DefaultAllocator alloc = DefaultAllocatorInit();
Int value = IntFrom(10, &alloc.base);
Int mod = IntFrom(13, &alloc.base);
Int root = IntInit(&alloc.base);- In
Math.c:846:
Int value = IntFrom(10, &alloc.base);
Int mod = IntFrom(13, &alloc.base);
Int root = IntInit(&alloc.base);
Int check = IntInit(&alloc.base);- In
Math.c:867:
DefaultAllocator alloc = DefaultAllocatorInit();
Int value = IntFrom(3, &alloc.base);
Int mod = IntFrom(7, &alloc.base);
Int root = IntFrom(99, &alloc.base);- In
Math.c:868:
Int value = IntFrom(3, &alloc.base);
Int mod = IntFrom(7, &alloc.base);
Int root = IntFrom(99, &alloc.base);- In
Math.c:869:
Int value = IntFrom(3, &alloc.base);
Int mod = IntFrom(7, &alloc.base);
Int root = IntFrom(99, &alloc.base);
bool result = !IntModSqrt(&root, &value, &mod);- In
Math.c:887:
Int prime = IntFromStr("1000000007", &alloc.base);
Int composite = IntFrom(561, &alloc.base);
bool result = IntIsProbablePrime(&prime);- In
Math.c:924:
DefaultAllocator alloc = DefaultAllocatorInit();
Int value = IntFrom(6, &alloc.base);
Int mod = IntFrom(15, &alloc.base);
Int result_value = IntFrom(99, &alloc.base);- In
Math.c:925:
Int value = IntFrom(6, &alloc.base);
Int mod = IntFrom(15, &alloc.base);
Int result_value = IntFrom(99, &alloc.base);- In
Math.c:926:
Int value = IntFrom(6, &alloc.base);
Int mod = IntFrom(15, &alloc.base);
Int result_value = IntFrom(99, &alloc.base);
bool result = !IntModInv(&result_value, &value, &mod);- In
Math.c:943:
DefaultAllocator alloc = DefaultAllocatorInit();
Int a = IntFrom(1, &alloc.base);
Int b = IntFrom(6, &alloc.base);
Int m = IntFrom(15, &alloc.base);- In
Math.c:944:
Int a = IntFrom(1, &alloc.base);
Int b = IntFrom(6, &alloc.base);
Int m = IntFrom(15, &alloc.base);
Int result_value = IntFrom(99, &alloc.base);- In
Math.c:945:
Int a = IntFrom(1, &alloc.base);
Int b = IntFrom(6, &alloc.base);
Int m = IntFrom(15, &alloc.base);
Int result_value = IntFrom(99, &alloc.base);- In
Math.c:946:
Int b = IntFrom(6, &alloc.base);
Int m = IntFrom(15, &alloc.base);
Int result_value = IntFrom(99, &alloc.base);
bool result = !IntModDiv(&result_value, &a, &b, &m);- In
Math.c:964:
DefaultAllocator alloc = DefaultAllocatorInit();
Int a = IntFrom(1, &alloc.base);
Int b = IntFrom(2, &alloc.base);- In
Math.c:965:
Int a = IntFrom(1, &alloc.base);
Int b = IntFrom(2, &alloc.base);
IntAdd(NULL, &a, &b);- In
Math.c:987:
DefaultAllocator alloc = DefaultAllocatorInit();
Int dividend = IntFrom(1, &alloc.base);
Int divisor = IntInit(&alloc.base);
Int quotient = IntFrom(99, &alloc.base);- In
Math.c:989:
Int dividend = IntFrom(1, &alloc.base);
Int divisor = IntInit(&alloc.base);
Int quotient = IntFrom(99, &alloc.base);
Int remainder = IntFrom(77, &alloc.base);- In
Math.c:990:
Int divisor = IntInit(&alloc.base);
Int quotient = IntFrom(99, &alloc.base);
Int remainder = IntFrom(77, &alloc.base);
bool result = !IntDivMod("ient, &remainder, ÷nd, &divisor);- In
Math.c:1010:
DefaultAllocator alloc = DefaultAllocatorInit();
Int value = IntFrom(16, &alloc.base);
Int root = IntFrom(99, &alloc.base);
Int remainder = IntFrom(77, &alloc.base);- In
Math.c:1011:
Int value = IntFrom(16, &alloc.base);
Int root = IntFrom(99, &alloc.base);
Int remainder = IntFrom(77, &alloc.base);
bool result = !IntRootRem(&root, &remainder, &value, 0);- In
Math.c:1012:
Int value = IntFrom(16, &alloc.base);
Int root = IntFrom(99, &alloc.base);
Int remainder = IntFrom(77, &alloc.base);
bool result = !IntRootRem(&root, &remainder, &value, 0);- In
Math.c:1030:
DefaultAllocator alloc = DefaultAllocatorInit();
Int dividend = IntFrom(10, &alloc.base);
Int quotient = IntFrom(99, &alloc.base);- In
Math.c:1031:
Int dividend = IntFrom(10, &alloc.base);
Int quotient = IntFrom(99, &alloc.base);
IntDiv("ient, ÷nd, 0u);- In
Math.c:1047:
DefaultAllocator alloc = DefaultAllocatorInit();
Int value = IntFrom(10, &alloc.base);
Int result_value = IntFrom(99, &alloc.base);- In
Math.c:1048:
Int value = IntFrom(10, &alloc.base);
Int result_value = IntFrom(99, &alloc.base);
IntMod(&result_value, &value, 0u);- In
Math.c:1064:
DefaultAllocator alloc = DefaultAllocatorInit();
Int a = IntFrom(10, &alloc.base);
Int b = IntFrom(3, &alloc.base);
Int m = IntInit(&alloc.base);- In
Math.c:1065:
Int a = IntFrom(10, &alloc.base);
Int b = IntFrom(3, &alloc.base);
Int m = IntInit(&alloc.base);
Int result_value = IntFrom(99, &alloc.base);- In
Math.c:1067:
Int b = IntFrom(3, &alloc.base);
Int m = IntInit(&alloc.base);
Int result_value = IntFrom(99, &alloc.base);
bool result = !IntModDiv(&result_value, &a, &b, &m);- In
Math.c:1085:
DefaultAllocator alloc = DefaultAllocatorInit();
Int a = IntFrom(3, &alloc.base);
Int n = IntFrom(8, &alloc.base);
int symbol = 99;- In
Math.c:1086:
Int a = IntFrom(3, &alloc.base);
Int n = IntFrom(8, &alloc.base);
int symbol = 99;
bool error = false;- In
Math.c:1106:
DefaultAllocator alloc = DefaultAllocatorInit();
Int base = IntFrom(2, &alloc.base);
Int mod = IntInit(&alloc.base);
Int result_value = IntInit(&alloc.base);- In
Math.c:1120:
DefaultAllocator alloc = DefaultAllocatorInit();
Int base = IntFrom(2, &alloc.base);
Int exp = IntFrom(8, &alloc.base);
Int mod = IntInit(&alloc.base);- In
Math.c:1121:
Int base = IntFrom(2, &alloc.base);
Int exp = IntFrom(8, &alloc.base);
Int mod = IntInit(&alloc.base);
Int result_value = IntFrom(99, &alloc.base);- In
Math.c:1123:
Int exp = IntFrom(8, &alloc.base);
Int mod = IntInit(&alloc.base);
Int result_value = IntFrom(99, &alloc.base);
bool result = !IntPowMod(&result_value, &base, &exp, &mod);- In
Math.c:1147:
DefaultAllocator alloc = DefaultAllocatorInit();
Int value = IntFrom(2, &alloc.base);
Int mod = IntFrom(7, &alloc.base);
Int root = IntFrom(99, &alloc.base);- In
Math.c:1148:
Int value = IntFrom(2, &alloc.base);
Int mod = IntFrom(7, &alloc.base);
Int root = IntFrom(99, &alloc.base);
Int check = IntInit(&alloc.base);- In
Math.c:1149:
Int value = IntFrom(2, &alloc.base);
Int mod = IntFrom(7, &alloc.base);
Int root = IntFrom(99, &alloc.base);
Int check = IntInit(&alloc.base);- In
Math.c:1178:
DefaultAllocator alloc = DefaultAllocatorInit();
Int value = IntFrom(3, &alloc.base);
Int mod = IntFrom(7, &alloc.base);
Int root = IntFrom(99, &alloc.base);- In
Math.c:1179:
Int value = IntFrom(3, &alloc.base);
Int mod = IntFrom(7, &alloc.base);
Int root = IntFrom(99, &alloc.base);- In
Math.c:1180:
Int value = IntFrom(3, &alloc.base);
Int mod = IntFrom(7, &alloc.base);
Int root = IntFrom(99, &alloc.base);
bool result = !IntModSqrt(&root, &value, &mod);- In
Math.c:1204:
DefaultAllocator alloc = DefaultAllocatorInit();
Int value = IntFrom(2, &alloc.base);
Int mod = IntFrom(17, &alloc.base);
Int root = IntFrom(99, &alloc.base);- In
Math.c:1205:
Int value = IntFrom(2, &alloc.base);
Int mod = IntFrom(17, &alloc.base);
Int root = IntFrom(99, &alloc.base);
Int check = IntInit(&alloc.base);- In
Math.c:1206:
Int value = IntFrom(2, &alloc.base);
Int mod = IntFrom(17, &alloc.base);
Int root = IntFrom(99, &alloc.base);
Int check = IntInit(&alloc.base);- In
Math.c:1234:
DefaultAllocator alloc = DefaultAllocatorInit();
Int value = IntFrom(4, &alloc.base);
Int mod = IntFrom(17, &alloc.base);
Int root = IntFrom(99, &alloc.base);- In
Math.c:1235:
Int value = IntFrom(4, &alloc.base);
Int mod = IntFrom(17, &alloc.base);
Int root = IntFrom(99, &alloc.base);
Int check = IntInit(&alloc.base);- In
Math.c:1236:
Int value = IntFrom(4, &alloc.base);
Int mod = IntFrom(17, &alloc.base);
Int root = IntFrom(99, &alloc.base);
Int check = IntInit(&alloc.base);- In
Math.c:1264:
DefaultAllocator alloc = DefaultAllocatorInit();
Int value = IntFrom(3, &alloc.base);
Int mod = IntFrom(97, &alloc.base);
Int root = IntFrom(99, &alloc.base);- In
Math.c:1265:
Int value = IntFrom(3, &alloc.base);
Int mod = IntFrom(97, &alloc.base);
Int root = IntFrom(99, &alloc.base);
Int check = IntInit(&alloc.base);- In
Math.c:1266:
Int value = IntFrom(3, &alloc.base);
Int mod = IntFrom(97, &alloc.base);
Int root = IntFrom(99, &alloc.base);
Int check = IntInit(&alloc.base);- In
Math.c:1293:
DefaultAllocator alloc = DefaultAllocatorInit();
Int value = IntFrom(2, &alloc.base);
Int mod = IntFrom(257, &alloc.base);
Int root = IntFrom(99, &alloc.base);- In
Math.c:1294:
Int value = IntFrom(2, &alloc.base);
Int mod = IntFrom(257, &alloc.base);
Int root = IntFrom(99, &alloc.base);
Int check = IntInit(&alloc.base);- In
Math.c:1295:
Int value = IntFrom(2, &alloc.base);
Int mod = IntFrom(257, &alloc.base);
Int root = IntFrom(99, &alloc.base);
Int check = IntInit(&alloc.base);- In
Math.c:1319:
DefaultAllocator alloc = DefaultAllocatorInit();
Int value = IntFrom(10, &alloc.base);
Int mod = IntFrom(13, &alloc.base);
Int root = IntFrom(99, &alloc.base);- In
Math.c:1320:
Int value = IntFrom(10, &alloc.base);
Int mod = IntFrom(13, &alloc.base);
Int root = IntFrom(99, &alloc.base);
Int check = IntInit(&alloc.base);- In
Math.c:1321:
Int value = IntFrom(10, &alloc.base);
Int mod = IntFrom(13, &alloc.base);
Int root = IntFrom(99, &alloc.base);
Int check = IntInit(&alloc.base);- In
Math.c:1345:
DefaultAllocator alloc = DefaultAllocatorInit();
Int value = IntFrom(2, &alloc.base);
Int mod = IntFrom(13, &alloc.base);
Int root = IntFrom(99, &alloc.base);- In
Math.c:1346:
Int value = IntFrom(2, &alloc.base);
Int mod = IntFrom(13, &alloc.base);
Int root = IntFrom(99, &alloc.base);- In
Math.c:1347:
Int value = IntFrom(2, &alloc.base);
Int mod = IntFrom(13, &alloc.base);
Int root = IntFrom(99, &alloc.base);
bool result = !IntModSqrt(&root, &value, &mod);- In
Math.c:1368:
DefaultAllocator alloc = DefaultAllocatorInit();
Int value = IntFrom(0, &alloc.base);
Int mod = IntFrom(7, &alloc.base);
Int root = IntFrom(99, &alloc.base);- In
Math.c:1369:
Int value = IntFrom(0, &alloc.base);
Int mod = IntFrom(7, &alloc.base);
Int root = IntFrom(99, &alloc.base);- In
Math.c:1370:
Int value = IntFrom(0, &alloc.base);
Int mod = IntFrom(7, &alloc.base);
Int root = IntFrom(99, &alloc.base);
bool result = IntModSqrt(&root, &value, &mod);- In
Math.c:1391:
DefaultAllocator alloc = DefaultAllocatorInit();
Int value = IntFrom(21, &alloc.base);
Int mod = IntFrom(7, &alloc.base);
Int root = IntFrom(99, &alloc.base);- In
Math.c:1392:
Int value = IntFrom(21, &alloc.base);
Int mod = IntFrom(7, &alloc.base);
Int root = IntFrom(99, &alloc.base);- In
Math.c:1393:
Int value = IntFrom(21, &alloc.base);
Int mod = IntFrom(7, &alloc.base);
Int root = IntFrom(99, &alloc.base);
bool result = IntModSqrt(&root, &value, &mod);- In
Math.c:1415:
DefaultAllocator alloc = DefaultAllocatorInit();
Int value = IntFrom(5, &alloc.base);
Int mod = IntFrom(2, &alloc.base);
Int root = IntFrom(99, &alloc.base);- In
Math.c:1416:
Int value = IntFrom(5, &alloc.base);
Int mod = IntFrom(2, &alloc.base);
Int root = IntFrom(99, &alloc.base);- In
Math.c:1417:
Int value = IntFrom(5, &alloc.base);
Int mod = IntFrom(2, &alloc.base);
Int root = IntFrom(99, &alloc.base);
bool result = IntModSqrt(&root, &value, &mod);- In
Math.c:1438:
DefaultAllocator alloc = DefaultAllocatorInit();
Int value = IntFrom(1, &alloc.base);
Int mod = IntFrom(8, &alloc.base);
Int root = IntFrom(99, &alloc.base);- In
Math.c:1439:
Int value = IntFrom(1, &alloc.base);
Int mod = IntFrom(8, &alloc.base);
Int root = IntFrom(99, &alloc.base);- In
Math.c:1440:
Int value = IntFrom(1, &alloc.base);
Int mod = IntFrom(8, &alloc.base);
Int root = IntFrom(99, &alloc.base);
bool result = !IntModSqrt(&root, &value, &mod);- In
Math.c:1459:
DefaultAllocator alloc = DefaultAllocatorInit();
Int value = IntFrom(4, &alloc.base);
Int mod = IntFrom(9, &alloc.base);
Int root = IntFrom(99, &alloc.base);- In
Math.c:1460:
Int value = IntFrom(4, &alloc.base);
Int mod = IntFrom(9, &alloc.base);
Int root = IntFrom(99, &alloc.base);- In
Math.c:1461:
Int value = IntFrom(4, &alloc.base);
Int mod = IntFrom(9, &alloc.base);
Int root = IntFrom(99, &alloc.base);
bool result = !IntModSqrt(&root, &value, &mod);- In
Math.c:1481:
DefaultAllocator alloc = DefaultAllocatorInit();
Int value = IntFrom(4, &alloc.base);
Int mod = IntInit(&alloc.base);
Int root = IntFrom(99, &alloc.base);- In
Math.c:1483:
Int value = IntFrom(4, &alloc.base);
Int mod = IntInit(&alloc.base);
Int root = IntFrom(99, &alloc.base);
bool result = !IntModSqrt(&root, &value, &mod);- In
Math.c:1505:
DefaultAllocator alloc = DefaultAllocatorInit();
Int value = IntFrom(23, &alloc.base);
Int mod = IntFrom(7, &alloc.base);
Int root = IntFrom(99, &alloc.base);- In
Math.c:1506:
Int value = IntFrom(23, &alloc.base);
Int mod = IntFrom(7, &alloc.base);
Int root = IntFrom(99, &alloc.base);
Int check = IntInit(&alloc.base);- In
Math.c:1507:
Int value = IntFrom(23, &alloc.base);
Int mod = IntFrom(7, &alloc.base);
Int root = IntFrom(99, &alloc.base);
Int check = IntInit(&alloc.base);- In
Math.c:1537:
/* 123456789 * 987654321 = 121932631112635269 */
Int a = IntFrom((u64)123456789u, &alloc.base);
Int b = IntFrom((u64)987654321u, &alloc.base);
Int product = IntInit(&alloc.base);- In
Math.c:1538:
/* 123456789 * 987654321 = 121932631112635269 */
Int a = IntFrom((u64)123456789u, &alloc.base);
Int b = IntFrom((u64)987654321u, &alloc.base);
Int product = IntInit(&alloc.base);- In
Math.c:1562:
DefaultAllocator alloc = DefaultAllocatorInit();
Int a = IntFrom((u64)999u, &alloc.base);
Int zero = IntInit(&alloc.base);
Int product = IntInit(&alloc.base);- In
Math.c:1590:
DefaultAllocator alloc = DefaultAllocatorInit();
Int a = IntFrom((u64)2u, &alloc.base);
Int b = IntFrom((u64)3u, &alloc.base);- In
Math.c:1591:
Int a = IntFrom((u64)2u, &alloc.base);
Int b = IntFrom((u64)3u, &alloc.base);
IntMul(NULL, &a, &b);- In
Math.c:1604:
DefaultAllocator alloc = DefaultAllocatorInit();
Int base = IntFrom(7, &alloc.base);
Int result = IntInit(&alloc.base);- In
Math.c:1640:
DefaultAllocator alloc = DefaultAllocatorInit();
Int a = IntFrom(12, &alloc.base);
Int b = IntFrom(8, &alloc.base);- In
Math.c:1641:
Int a = IntFrom(12, &alloc.base);
Int b = IntFrom(8, &alloc.base);
IntGCD(NULL, &a, &b);- In
Math.c:1664:
DefaultAllocator alloc = DefaultAllocatorInit();
Int b = IntFrom(8, &alloc.base);
Int result = IntInit(&alloc.base);- In
Math.c:1685:
DefaultAllocator alloc = DefaultAllocatorInit();
Int a = IntFrom(12, &alloc.base);
Int result = IntInit(&alloc.base);- In
Math.c:1708:
DefaultAllocator alloc = DefaultAllocatorInit();
Int a = IntFrom(7, &alloc.base);
Int b = IntFrom(3, &alloc.base);
Int m = IntFrom(11, &alloc.base);- In
Math.c:1709:
Int a = IntFrom(7, &alloc.base);
Int b = IntFrom(3, &alloc.base);
Int m = IntFrom(11, &alloc.base);- In
Math.c:1710:
Int a = IntFrom(7, &alloc.base);
Int b = IntFrom(3, &alloc.base);
Int m = IntFrom(11, &alloc.base);
IntModAdd(NULL, &a, &b, &m);- In
Math.c:1735:
DefaultAllocator alloc = DefaultAllocatorInit();
Int a = IntFrom(3, &alloc.base);
Int b = IntFrom(5, &alloc.base);
Int mod = IntFrom(7, &alloc.base);- In
Math.c:1736:
Int a = IntFrom(3, &alloc.base);
Int b = IntFrom(5, &alloc.base);
Int mod = IntFrom(7, &alloc.base);- In
Math.c:1737:
Int a = IntFrom(3, &alloc.base);
Int b = IntFrom(5, &alloc.base);
Int mod = IntFrom(7, &alloc.base);
IntModMul(NULL, &a, &b, &mod);- In
Math.c:1761:
DefaultAllocator alloc = DefaultAllocatorInit();
Int a = IntFrom(4, &alloc.base);
Int b = IntFrom(1, &alloc.base);
Int result_value = IntInit(&alloc.base);- In
Math.c:1762:
Int a = IntFrom(4, &alloc.base);
Int b = IntFrom(1, &alloc.base);
Int result_value = IntInit(&alloc.base);- In
Math.c:1787:
DefaultAllocator alloc = DefaultAllocatorInit();
Int a = IntFrom(9, &alloc.base);
Int b = IntFrom(2, &alloc.base);- In
Math.c:1788:
Int a = IntFrom(9, &alloc.base);
Int b = IntFrom(2, &alloc.base);
int_sub(NULL, &a, &b);- In
Math.c:1806:
DefaultAllocator alloc = DefaultAllocatorInit();
Int dividend = IntFrom(100, &alloc.base);
int_div_u64_rem(NULL, ÷nd, 7);- In
Math.c:1843:
DefaultAllocator alloc = DefaultAllocatorInit();
Int a = IntFrom(0, &alloc.base);
Int b = IntFrom(5, &alloc.base);
Int result_value = IntFrom(99, &alloc.base);- In
Math.c:1844:
Int a = IntFrom(0, &alloc.base);
Int b = IntFrom(5, &alloc.base);
Int result_value = IntFrom(99, &alloc.base);- In
Math.c:1845:
Int a = IntFrom(0, &alloc.base);
Int b = IntFrom(5, &alloc.base);
Int result_value = IntFrom(99, &alloc.base);
bool result = IntLCM(&result_value, &a, &b);- In
Math.c:1875:
// 32 = 2^5: only perfect-power exponent in [2, max_degree] is the boundary
// value max_degree itself, so it distinguishes `<=` from `<`.
Int boundary = IntFrom(32, &alloc.base);
// 64 = 2^6 = 8^2 = 4^3 = 2^6: a perfect square found at degree 2, used as a
// sanity anchor so the test also exercises the common early-hit path.
- In
Math.c:1878:
// 64 = 2^6 = 8^2 = 4^3 = 2^6: a perfect square found at degree 2, used as a
// sanity anchor so the test also exercises the common early-hit path.
Int square_anchor = IntFrom(64, &alloc.base);
bool result = IntIsPerfectPower(&boundary);- In
Math.c:1905:
DefaultAllocator alloc = DefaultAllocatorInit();
Int dividend = IntFrom(12, &alloc.base);
Int divisor = IntFrom(4, &alloc.base);- In
Math.c:1906:
Int dividend = IntFrom(12, &alloc.base);
Int divisor = IntFrom(4, &alloc.base);
IntDivExact(NULL, ÷nd, &divisor);- In
Math.c:1926:
Int ones = IntFromBinary("1111111", &alloc.base); // 127
Int one = IntFrom(1u, &alloc.base);
Int sum = IntInit(&alloc.base);- In
Math.c:1951:
DefaultAllocator alloc = DefaultAllocatorInit();
Int value = IntFrom(0, &alloc.base);
Int root = IntFrom(99, &alloc.base);
Int remainder = IntFrom(77, &alloc.base);- In
Math.c:1952:
Int value = IntFrom(0, &alloc.base);
Int root = IntFrom(99, &alloc.base);
Int remainder = IntFrom(77, &alloc.base);- In
Math.c:1953:
Int value = IntFrom(0, &alloc.base);
Int root = IntFrom(99, &alloc.base);
Int remainder = IntFrom(77, &alloc.base);
bool ok = IntRootRem(&root, &remainder, &value, 3);- In
Math.c:1976:
DefaultAllocator alloc = DefaultAllocatorInit();
Int value = IntFrom(10000, &alloc.base);
Int root = IntInit(&alloc.base);
Int remainder = IntInit(&alloc.base);- In
Math.c:1999:
DefaultAllocator alloc = DefaultAllocatorInit();
Int value = IntFrom(1000, &alloc.base);
Int root = IntInit(&alloc.base);
Int remainder = IntInit(&alloc.base);- In
Math.c:2023:
DefaultAllocator alloc = DefaultAllocatorInit();
Int value = IntFrom(1001, &alloc.base);
Int root = IntInit(&alloc.base);
Int remainder = IntInit(&alloc.base);- In
Math.c:2046:
DefaultAllocator alloc = DefaultAllocatorInit();
Int value = IntFrom(999, &alloc.base);
Int root = IntInit(&alloc.base);
Int remainder = IntInit(&alloc.base);- In
Math.c:2069:
DefaultAllocator alloc = DefaultAllocatorInit();
Int value = IntFrom(1000000, &alloc.base);
Int root = IntInit(&alloc.base);
Int remainder = IntInit(&alloc.base);- In
Math.c:2100:
DefaultAllocator alloc = DefaultAllocatorInit();
Int base = IntFrom(7, &alloc.base);
Int exp = IntFrom(5, &alloc.base);
Int power = IntInit(&alloc.base);- In
Math.c:2101:
Int base = IntFrom(7, &alloc.base);
Int exp = IntFrom(5, &alloc.base);
Int power = IntInit(&alloc.base);- In
Math.c:2126:
DefaultAllocator alloc = DefaultAllocatorInit();
Int base = IntFrom(2, &alloc.base);
// 2**64 == 18446744073709551616 -> bit length 65, does not fit u64.
Int exp = IntFromStr("18446744073709551616", &alloc.base);- In
Math.c:2129:
// 2**64 == 18446744073709551616 -> bit length 65, does not fit u64.
Int exp = IntFromStr("18446744073709551616", &alloc.base);
Int power = IntFrom(123, &alloc.base);
Int sentinel = IntFrom(123, &alloc.base);- In
Math.c:2130:
Int exp = IntFromStr("18446744073709551616", &alloc.base);
Int power = IntFrom(123, &alloc.base);
Int sentinel = IntFrom(123, &alloc.base);
bool rejected = !IntPow(&power, &base, &exp);- In
Math.c:2158:
DefaultAllocator alloc = DefaultAllocatorInit();
Int dividend = IntFrom(1000, &alloc.base);
Int quotient = IntInit(&alloc.base);- In
Math.c:2181:
DefaultAllocator alloc = DefaultAllocatorInit();
Int dividend = IntFrom(1000, &alloc.base);
Int quotient = IntFrom(55, &alloc.base);- In
Math.c:2182:
Int dividend = IntFrom(1000, &alloc.base);
Int quotient = IntFrom(55, &alloc.base);
bool failed = !IntDiv("ient, ÷nd, (i64)-7);- In
Math.c:2204:
DefaultAllocator alloc = DefaultAllocatorInit();
Int dividend = IntFrom(1001, &alloc.base);
Int quotient = IntInit(&alloc.base);- In
Math.c:2225:
DefaultAllocator alloc = DefaultAllocatorInit();
Int dividend = IntFrom(1001, &alloc.base);
Int quotient = IntFrom(55, &alloc.base);- In
Math.c:2226:
Int dividend = IntFrom(1001, &alloc.base);
Int quotient = IntFrom(55, &alloc.base);
bool failed = !IntDivExact("ient, ÷nd, (i64)-7);- In
Math.c:2252:
// ---------------------------------------------------------------------------
bool test_m24_from_u64_roundtrip(void) {
WriteFmt("Testing IntFrom(5u) round-trip and bit length\n");
DefaultAllocator alloc = DefaultAllocatorInit();- In
Math.c:2256:
DefaultAllocator alloc = DefaultAllocatorInit();
Int value = IntFrom(5u, &alloc.base);
bool fail = (IntCompare(&value, 5u) != 0);- In
Math.c:2270:
// stored value or trips the allocation guard).
bool test_m24_from_u64_value_one(void) {
WriteFmt("Testing IntFrom(1u) round-trip\n");
DefaultAllocator alloc = DefaultAllocatorInit();- In
Math.c:2274:
DefaultAllocator alloc = DefaultAllocatorInit();
Int value = IntFrom(1u, &alloc.base);
bool fail = (IntCompare(&value, 1u) != 0);- In
Math.c:2298:
DefaultAllocator alloc = DefaultAllocatorInit();
Int value = IntFrom(7, &alloc.base);
Int result_value = IntFrom(99, &alloc.base);- In
Math.c:2299:
Int value = IntFrom(7, &alloc.base);
Int result_value = IntFrom(99, &alloc.base);
/* Signed literal forces int_mul_i64 dispatch. */- In
Math.c:2323:
DefaultAllocator alloc = DefaultAllocatorInit();
Int value = IntFrom(123, &alloc.base);
Int result_value = IntFrom(99, &alloc.base);- In
Math.c:2324:
Int value = IntFrom(123, &alloc.base);
Int result_value = IntFrom(99, &alloc.base);
bool ok = IntMul(&result_value, &value, (i64)0);- In
Math.c:2348:
DefaultAllocator alloc = DefaultAllocatorInit();
Int base = IntFrom(3, &alloc.base);
Int result_value = IntFrom(99, &alloc.base);- In
Math.c:2349:
Int base = IntFrom(3, &alloc.base);
Int result_value = IntFrom(99, &alloc.base);
bool ok = IntPow(&result_value, &base, (i64)4);- In
Math.c:2372:
DefaultAllocator alloc = DefaultAllocatorInit();
Int base = IntFrom(7, &alloc.base);
Int result_value = IntFrom(99, &alloc.base);- In
Math.c:2373:
Int base = IntFrom(7, &alloc.base);
Int result_value = IntFrom(99, &alloc.base);
bool ok = IntPow(&result_value, &base, (i64)0);- In
Math.c:2396:
DefaultAllocator alloc = DefaultAllocatorInit();
Int dividend = IntFrom(100, &alloc.base);
Int result_value = IntFrom(99, &alloc.base);- In
Math.c:2397:
Int dividend = IntFrom(100, &alloc.base);
Int result_value = IntFrom(99, &alloc.base);
/* Unsigned literal forces int_div_u64 dispatch. */- In
Math.c:2420:
DefaultAllocator alloc = DefaultAllocatorInit();
Int dividend = IntFrom(123456789, &alloc.base);
Int result_value = IntInit(&alloc.base);- In
Math.c:2533:
DefaultAllocator alloc = DefaultAllocatorInit();
Int base = IntFrom(7, &alloc.base);
Int modulus = IntFrom(1000000007, &alloc.base);
Int result_value = IntInit(&alloc.base);- In
Math.c:2534:
Int base = IntFrom(7, &alloc.base);
Int modulus = IntFrom(1000000007, &alloc.base);
Int result_value = IntInit(&alloc.base);- In
Math.c:2560:
DefaultAllocator alloc = DefaultAllocatorInit();
Int base = IntFrom(7, &alloc.base);
Int modulus = IntFrom(1000000007, &alloc.base);
Int result_value = IntInit(&alloc.base);- In
Math.c:2561:
Int base = IntFrom(7, &alloc.base);
Int modulus = IntFrom(1000000007, &alloc.base);
Int result_value = IntInit(&alloc.base);- In
Math.c:2585:
DefaultAllocator alloc = DefaultAllocatorInit();
Int value = IntFrom(4096, &alloc.base);
Int result_value = IntInit(&alloc.base);- In
Math.c:2633:
DefaultAllocator alloc = DefaultAllocatorInit();
Int dividend = IntFrom((u64)100u, &alloc.base);
Int result = IntInit(&alloc.base);- In
Math.c:2673:
DefaultAllocator alloc = DefaultAllocatorInit();
Int a = IntFrom(2, &alloc.base);
Int n_odd = IntFrom(7, &alloc.base);
Int n_even = IntFrom(8, &alloc.base);- In
Math.c:2674:
Int a = IntFrom(2, &alloc.base);
Int n_odd = IntFrom(7, &alloc.base);
Int n_even = IntFrom(8, &alloc.base);- In
Math.c:2675:
Int a = IntFrom(2, &alloc.base);
Int n_odd = IntFrom(7, &alloc.base);
Int n_even = IntFrom(8, &alloc.base);
bool err_ok = true;- In
Math.c:2708:
DefaultAllocator alloc = DefaultAllocatorInit();
Int value = IntFrom(3, &alloc.base);
Int mod = IntFrom(11, &alloc.base);
Int result = IntInit(&alloc.base);- In
Math.c:2709:
Int value = IntFrom(3, &alloc.base);
Int mod = IntFrom(11, &alloc.base);
Int result = IntInit(&alloc.base);
Int check = IntInit(&alloc.base);- In
Math.c:2742:
DefaultAllocator alloc = DefaultAllocatorInit();
Int value = IntFrom(5, &alloc.base);
Int mod = IntFrom(11, &alloc.base);
Int result = IntInit(&alloc.base);- In
Math.c:2743:
Int value = IntFrom(5, &alloc.base);
Int mod = IntFrom(11, &alloc.base);
Int result = IntInit(&alloc.base);
Int check = IntInit(&alloc.base);- In
Math.c:2774:
DefaultAllocator alloc = DefaultAllocatorInit();
Int dividend = IntFrom(10, &alloc.base);
Int quotient = IntFrom(99, &alloc.base);- In
Math.c:2775:
Int dividend = IntFrom(10, &alloc.base);
Int quotient = IntFrom(99, &alloc.base);
bool ok = IntDiv("ient, ÷nd, 0u);- In
Math.c:2792:
DefaultAllocator alloc = DefaultAllocatorInit();
Int dividend = IntFrom(10, &alloc.base);
Int quotient = IntFrom(99, &alloc.base);- In
Math.c:2793:
Int dividend = IntFrom(10, &alloc.base);
Int quotient = IntFrom(99, &alloc.base);
bool ok = IntDiv("ient, ÷nd, (i64)0);- In
Math.c:2814:
DefaultAllocator alloc = DefaultAllocatorInit();
Int dividend = IntFrom(127, &alloc.base);
Int quotient = IntInit(&alloc.base);- In
Math.c:2831:
DefaultAllocator alloc = DefaultAllocatorInit();
Int dividend = IntFrom(127, &alloc.base);
Int quotient = IntInit(&alloc.base);- In
Math.c:2851:
DefaultAllocator alloc = DefaultAllocatorInit();
Int dividend = IntFrom(127, &alloc.base);
Int quotient = IntInit(&alloc.base);
Int remainder = IntInit(&alloc.base);- In
Math.c:2870:
DefaultAllocator alloc = DefaultAllocatorInit();
Int dividend = IntFrom(127, &alloc.base);
Int quotient = IntInit(&alloc.base);
Int remainder = IntInit(&alloc.base);- In
Math.c:2892:
DefaultAllocator alloc = DefaultAllocatorInit();
Int dividend = IntFrom(127, &alloc.base);
Int result_value = IntInit(&alloc.base);- In
Math.c:2909:
DefaultAllocator alloc = DefaultAllocatorInit();
Int dividend = IntFrom(127, &alloc.base);
Int result_value = IntInit(&alloc.base);- In
Math.c:2932:
DefaultAllocator alloc = DefaultAllocatorInit();
Int value = IntFrom(1, &alloc.base);
IntShiftLeft(&value, 50); // 2^50
- In
Math.c:2958:
DefaultAllocator alloc = DefaultAllocatorInit();
Int a = IntFrom(3, &alloc.base);
Int n = IntFrom(7, &alloc.base);- In
Math.c:2959:
Int a = IntFrom(3, &alloc.base);
Int n = IntFrom(7, &alloc.base);
int symbol = 99;- In
Math.c:2982:
DefaultAllocator alloc = DefaultAllocatorInit();
Int value = IntFrom(2, &alloc.base);
Int mod = IntFrom(17, &alloc.base);
Int root = IntInit(&alloc.base);- In
Math.c:2983:
Int value = IntFrom(2, &alloc.base);
Int mod = IntFrom(17, &alloc.base);
Int root = IntInit(&alloc.base);
Int check = IntInit(&alloc.base);- In
Math.c:3004:
DefaultAllocator alloc = DefaultAllocatorInit();
Int value = IntFrom(1, &alloc.base);
bool result = !IntIsProbablePrime(&value);- In
Math.c:3018:
DefaultAllocator alloc = DefaultAllocatorInit();
Int value = IntFrom(2, &alloc.base);
bool result = IntIsProbablePrime(&value);- In
Math.c:3032:
DefaultAllocator alloc = DefaultAllocatorInit();
Int value = IntFrom(4, &alloc.base);
bool result = !IntIsProbablePrime(&value);- In
Math.c:3046:
DefaultAllocator alloc = DefaultAllocatorInit();
Int value = IntFrom(3, &alloc.base);
bool result = IntIsProbablePrime(&value);- In
Math.c:3060:
DefaultAllocator alloc = DefaultAllocatorInit();
Int value = IntFrom(97, &alloc.base);
bool result = IntIsProbablePrime(&value);- In
Math.c:3074:
DefaultAllocator alloc = DefaultAllocatorInit();
Int value = IntFrom(561, &alloc.base);
bool result = !IntIsProbablePrime(&value);- In
Math.c:3088:
DefaultAllocator alloc = DefaultAllocatorInit();
Int value = IntFrom(1763, &alloc.base);
bool result = !IntIsProbablePrime(&value);- In
Math.c:3130:
DefaultAllocator alloc = DefaultAllocatorInit();
Int value = IntFrom(97, &alloc.base);
bool error = true;- In
Math.c:3338:
DefaultAllocator alloc = DefaultAllocatorInit();
Int base = IntFrom(7, &alloc.base);
Int exp = IntFrom(0, &alloc.base);
Int mod = IntFrom(1, &alloc.base);- In
Math.c:3339:
Int base = IntFrom(7, &alloc.base);
Int exp = IntFrom(0, &alloc.base);
Int mod = IntFrom(1, &alloc.base);
Int result_value = IntFrom(99, &alloc.base);- In
Math.c:3340:
Int base = IntFrom(7, &alloc.base);
Int exp = IntFrom(0, &alloc.base);
Int mod = IntFrom(1, &alloc.base);
Int result_value = IntFrom(99, &alloc.base);- In
Math.c:3341:
Int exp = IntFrom(0, &alloc.base);
Int mod = IntFrom(1, &alloc.base);
Int result_value = IntFrom(99, &alloc.base);
bool ok = int_pow_mod(&result_value, &base, &exp, &mod);- In
Math.c:3359:
DefaultAllocator alloc = DefaultAllocatorInit();
Int base = IntFrom(123456, &alloc.base);
Int exp = IntFrom(11, &alloc.base);
Int mod = IntFrom(1, &alloc.base);- In
Math.c:3360:
Int base = IntFrom(123456, &alloc.base);
Int exp = IntFrom(11, &alloc.base);
Int mod = IntFrom(1, &alloc.base);
Int result_value = IntFrom(42, &alloc.base);- In
Math.c:3361:
Int base = IntFrom(123456, &alloc.base);
Int exp = IntFrom(11, &alloc.base);
Int mod = IntFrom(1, &alloc.base);
Int result_value = IntFrom(42, &alloc.base);- In
Math.c:3362:
Int exp = IntFrom(11, &alloc.base);
Int mod = IntFrom(1, &alloc.base);
Int result_value = IntFrom(42, &alloc.base);
bool ok = int_pow_mod(&result_value, &base, &exp, &mod);- In
Math.c:3380:
DefaultAllocator alloc = DefaultAllocatorInit();
Int base = IntFrom(3, &alloc.base);
Int exp = IntFrom(13, &alloc.base);
Int mod = IntFrom(497, &alloc.base);- In
Math.c:3381:
Int base = IntFrom(3, &alloc.base);
Int exp = IntFrom(13, &alloc.base);
Int mod = IntFrom(497, &alloc.base);
Int result_value = IntInit(&alloc.base);- In
Math.c:3382:
Int base = IntFrom(3, &alloc.base);
Int exp = IntFrom(13, &alloc.base);
Int mod = IntFrom(497, &alloc.base);
Int result_value = IntInit(&alloc.base);- In
Math.c:3401:
DebugAllocator dbg = DebugAllocatorInit();
Int base = IntFrom(123456789u, &dbg.base);
Int exp = IntFrom(987654321u, &dbg.base); // many set bits + bits
Int mod = IntFrom(1000000007u, &dbg.base);- In
Math.c:3402:
Int base = IntFrom(123456789u, &dbg.base);
Int exp = IntFrom(987654321u, &dbg.base); // many set bits + bits
Int mod = IntFrom(1000000007u, &dbg.base);
Int result_value = IntInit(&dbg.base);- In
Math.c:3403:
Int base = IntFrom(123456789u, &dbg.base);
Int exp = IntFrom(987654321u, &dbg.base); // many set bits + bits
Int mod = IntFrom(1000000007u, &dbg.base);
Int result_value = IntInit(&dbg.base);- In
Math.c:3433:
DefaultAllocator alloc = DefaultAllocatorInit();
Int value = IntFrom(0, &alloc.base);
Int next = IntInit(&alloc.base);- In
Math.c:3461:
DefaultAllocator alloc = DefaultAllocatorInit();
Int value = IntFrom(10, &alloc.base);
Int next = IntInit(&alloc.base);- In
Math.c:3484:
DefaultAllocator alloc = DefaultAllocatorInit();
Int value = IntFrom(9, &alloc.base);
Int next = IntInit(&alloc.base);- In
Math.c:3508:
DefaultAllocator alloc = DefaultAllocatorInit();
Int value = IntFrom(10, &alloc.base);
(void)IntNextPrime(NULL, &value);- In
Math.c:3527:
DefaultAllocator alloc = DefaultAllocatorInit();
Int a = IntFrom(9, &alloc.base);
Int b = IntFrom(5, &alloc.base);
Int m = IntFrom(13, &alloc.base);- In
Math.c:3528:
Int a = IntFrom(9, &alloc.base);
Int b = IntFrom(5, &alloc.base);
Int m = IntFrom(13, &alloc.base);
Int result_value = IntInit(&alloc.base);- In
Math.c:3529:
Int a = IntFrom(9, &alloc.base);
Int b = IntFrom(5, &alloc.base);
Int m = IntFrom(13, &alloc.base);
Int result_value = IntInit(&alloc.base);- In
Math.c:3555:
DefaultAllocator alloc = DefaultAllocatorInit();
Int a = IntFrom(7, &alloc.base);
Int b = IntFrom(3, &alloc.base);
Int m = IntFrom(11, &alloc.base);- In
Math.c:3556:
Int a = IntFrom(7, &alloc.base);
Int b = IntFrom(3, &alloc.base);
Int m = IntFrom(11, &alloc.base);- In
Math.c:3557:
Int a = IntFrom(7, &alloc.base);
Int b = IntFrom(3, &alloc.base);
Int m = IntFrom(11, &alloc.base);
IntModSub(NULL, &a, &b, &m);- In
Math.c:3574:
DefaultAllocator alloc = DefaultAllocatorInit();
Int base = IntFrom(3, &alloc.base);
Int mod = IntFrom(17, &alloc.base);
Int result_value = IntInit(&alloc.base);- In
Math.c:3575:
Int base = IntFrom(3, &alloc.base);
Int mod = IntFrom(17, &alloc.base);
Int result_value = IntInit(&alloc.base);- In
Math.c:3596:
DefaultAllocator alloc = DefaultAllocatorInit();
Int base = IntFrom(123456789, &alloc.base);
Int mod = IntFrom(1000000007, &alloc.base);
Int result_value = IntInit(&alloc.base);- In
Math.c:3597:
Int base = IntFrom(123456789, &alloc.base);
Int mod = IntFrom(1000000007, &alloc.base);
Int result_value = IntInit(&alloc.base);- In
Math.c:3620:
DefaultAllocator alloc = DefaultAllocatorInit();
Int base = IntFrom(2, &alloc.base);
Int mod = IntFrom(1000000007, &alloc.base);
Int result_value = IntInit(&alloc.base);- In
Math.c:3621:
Int base = IntFrom(2, &alloc.base);
Int mod = IntFrom(1000000007, &alloc.base);
Int result_value = IntInit(&alloc.base);- In
Math.c:3641:
DefaultAllocator alloc = DefaultAllocatorInit();
Int base = IntFrom(2, &alloc.base);
Int mod = IntFrom(7, &alloc.base);- In
Math.c:3642:
Int base = IntFrom(2, &alloc.base);
Int mod = IntFrom(7, &alloc.base);
IntPowMod((Int *)NULL, &base, 5u, &mod);- In
Math.c:3657:
Int result_value = IntInit(&alloc.base);
Int mod = IntFrom(7, &alloc.base);
IntPowMod(&result_value, (Int *)NULL, 5u, &mod);- In
Math.c:3672:
Int result_value = IntInit(&alloc.base);
Int base = IntFrom(2, &alloc.base);
IntPowMod(&result_value, &base, 5u, (Int *)NULL);- In
Math.c:3684:
Allocator *a = ALLOCATOR_OF(&dbg);
Int x = IntFrom(123456u, a);
Int y = IntFrom(7891011u, a);
Int r = IntInit(a);- In
Math.c:3685:
Int x = IntFrom(123456u, a);
Int y = IntFrom(7891011u, a);
Int r = IntInit(a);- In
Math.c:3703:
Allocator *a = ALLOCATOR_OF(&dbg);
Int x = IntFrom(0u, a);
Int y = IntFrom(7891011u, a);
Int r = IntFrom(42u, a); // r starts non-empty so the internal deinit matters
- In
Math.c:3704:
Int x = IntFrom(0u, a);
Int y = IntFrom(7891011u, a);
Int r = IntFrom(42u, a); // r starts non-empty so the internal deinit matters
- In
Math.c:3705:
Int x = IntFrom(0u, a);
Int y = IntFrom(7891011u, a);
Int r = IntFrom(42u, a); // r starts non-empty so the internal deinit matters
bool ok = IntMul(&r, &x, &y);- In
Math.c:3722:
Allocator *a = ALLOCATOR_OF(&dbg);
Int x = IntFrom(0xFFFFFFFFull, a);
Int y = IntFrom(0xFFFFFFFFull, a);
Int r = IntFrom(7u, a);- In
Math.c:3723:
Int x = IntFrom(0xFFFFFFFFull, a);
Int y = IntFrom(0xFFFFFFFFull, a);
Int r = IntFrom(7u, a);- In
Math.c:3724:
Int x = IntFrom(0xFFFFFFFFull, a);
Int y = IntFrom(0xFFFFFFFFull, a);
Int r = IntFrom(7u, a);
bool ok = IntAdd(&r, &x, &y);- In
Math.c:3741:
Allocator *a = ALLOCATOR_OF(&dbg);
Int x = IntFrom(1000000u, a);
Int y = IntFrom(999983u, a);
Int r = IntFrom(7u, a);- In
Math.c:3742:
Int x = IntFrom(1000000u, a);
Int y = IntFrom(999983u, a);
Int r = IntFrom(7u, a);- In
Math.c:3743:
Int x = IntFrom(1000000u, a);
Int y = IntFrom(999983u, a);
Int r = IntFrom(7u, a);
bool ok = IntSub(&r, &x, &y);- In
Math.c:3762:
// IntAdd with a u64 operand drives int_add_u64 -> int_add_u64_in_place,
// which frees lhs/rhs temporaries on success (lines 276/277).
Int x = IntFrom(500u, a);
Int r = IntFrom(7u, a);- In
Math.c:3763:
// which frees lhs/rhs temporaries on success (lines 276/277).
Int x = IntFrom(500u, a);
Int r = IntFrom(7u, a);
bool ok = IntAdd(&r, &x, 250u);- In
Math.c:3781:
// IntMul with a u64 operand drives int_mul_u64 -> int_mul_u64_in_place,
// which frees lhs/rhs temporaries on success (lines 251/252).
Int x = IntFrom(500u, a);
Int r = IntFrom(7u, a);- In
Math.c:3782:
// which frees lhs/rhs temporaries on success (lines 251/252).
Int x = IntFrom(500u, a);
Int r = IntFrom(7u, a);
bool ok = IntMul(&r, &x, 13u);- In
Math.c:3798:
Allocator *a = ALLOCATOR_OF(&dbg);
Int x = IntFrom(1000u, a);
Int r = IntFrom(7u, a);- In
Math.c:3799:
Int x = IntFrom(1000u, a);
Int r = IntFrom(7u, a);
bool ok = IntSub(&r, &x, 250u); // int_sub_u64 frees rhs on success (1187)
- In
Math.c:3817:
// dividend >= divisor drives the long-division branch (lines 1378..1411,
// 1420..1423 replace/deinit).
Int dvd = IntFrom(1000003u, a);
Int dvs = IntFrom(101u, a);
Int q = IntFrom(7u, a);- In
Math.c:3818:
// 1420..1423 replace/deinit).
Int dvd = IntFrom(1000003u, a);
Int dvs = IntFrom(101u, a);
Int q = IntFrom(7u, a);
Int r = IntFrom(9u, a);- In
Math.c:3819:
Int dvd = IntFrom(1000003u, a);
Int dvs = IntFrom(101u, a);
Int q = IntFrom(7u, a);
Int r = IntFrom(9u, a);- In
Math.c:3820:
Int dvs = IntFrom(101u, a);
Int q = IntFrom(7u, a);
Int r = IntFrom(9u, a);
bool ok = IntDivMod(&q, &r, &dvd, &dvs);- In
Math.c:3839:
// dividend < divisor drives the else branch (line 1413: deinit+reinit q).
Int dvd = IntFrom(50u, a);
Int dvs = IntFrom(101u, a);
Int q = IntFrom(7u, a);- In
Math.c:3840:
// dividend < divisor drives the else branch (line 1413: deinit+reinit q).
Int dvd = IntFrom(50u, a);
Int dvs = IntFrom(101u, a);
Int q = IntFrom(7u, a);
Int r = IntFrom(9u, a);- In
Math.c:3841:
Int dvd = IntFrom(50u, a);
Int dvs = IntFrom(101u, a);
Int q = IntFrom(7u, a);
Int r = IntFrom(9u, a);- In
Math.c:3842:
Int dvs = IntFrom(101u, a);
Int q = IntFrom(7u, a);
Int r = IntFrom(9u, a);
bool ok = IntDivMod(&q, &r, &dvd, &dvs);- In
Math.c:3860:
Allocator *a = ALLOCATOR_OF(&dbg);
Int dvd = IntFrom(1000003u, a);
Int dvs = IntFrom(101u, a);
Int r = IntFrom(7u, a);- In
Math.c:3861:
Int dvd = IntFrom(1000003u, a);
Int dvs = IntFrom(101u, a);
Int r = IntFrom(7u, a);- In
Math.c:3862:
Int dvd = IntFrom(1000003u, a);
Int dvs = IntFrom(101u, a);
Int r = IntFrom(7u, a);
bool ok = IntDiv(&r, &dvd, &dvs); // int_div frees remainder on success (1445)
- In
Math.c:3879:
Allocator *a = ALLOCATOR_OF(&dbg);
Int dvd = IntFrom(1000u, a);
Int dvs = IntFrom(8u, a);
Int r = IntFrom(7u, a);- In
Math.c:3880:
Int dvd = IntFrom(1000u, a);
Int dvs = IntFrom(8u, a);
Int r = IntFrom(7u, a);- In
Math.c:3881:
Int dvd = IntFrom(1000u, a);
Int dvs = IntFrom(8u, a);
Int r = IntFrom(7u, a);
bool ok = IntDivExact(&r, &dvd, &dvs); // frees remainder on success (1474)
- In
Math.c:3900:
// int_div_u64 / int_div_exact_u64 / int_div_i64 etc. free divisor_value
// on success (1488, 1514, 1501, 1527).
Int dvd = IntFrom(1000u, a);
Int r1 = IntFrom(7u, a);
Int r2 = IntFrom(7u, a);- In
Math.c:3901:
// on success (1488, 1514, 1501, 1527).
Int dvd = IntFrom(1000u, a);
Int r1 = IntFrom(7u, a);
Int r2 = IntFrom(7u, a);
Int r3 = IntFrom(7u, a);- In
Math.c:3902:
Int dvd = IntFrom(1000u, a);
Int r1 = IntFrom(7u, a);
Int r2 = IntFrom(7u, a);
Int r3 = IntFrom(7u, a);- In
Math.c:3903:
Int r1 = IntFrom(7u, a);
Int r2 = IntFrom(7u, a);
Int r3 = IntFrom(7u, a);
bool ok = IntDiv(&r1, &dvd, 8u);- In
Math.c:3925:
// int_div_mod_u64 / int_div_mod_i64 free divisor_value on success
// (1540, 1553); int_mod_u64_into / int_mod_i64_into free quotient (1607/1615).
Int dvd = IntFrom(1003u, a);
Int q = IntFrom(7u, a);
Int r = IntFrom(7u, a);- In
Math.c:3926:
// (1540, 1553); int_mod_u64_into / int_mod_i64_into free quotient (1607/1615).
Int dvd = IntFrom(1003u, a);
Int q = IntFrom(7u, a);
Int r = IntFrom(7u, a);
Int m1 = IntFrom(7u, a);- In
Math.c:3927:
Int dvd = IntFrom(1003u, a);
Int q = IntFrom(7u, a);
Int r = IntFrom(7u, a);
Int m1 = IntFrom(7u, a);
Int m2 = IntFrom(7u, a);- In
Math.c:3928:
Int q = IntFrom(7u, a);
Int r = IntFrom(7u, a);
Int m1 = IntFrom(7u, a);
Int m2 = IntFrom(7u, a);- In
Math.c:3929:
Int r = IntFrom(7u, a);
Int m1 = IntFrom(7u, a);
Int m2 = IntFrom(7u, a);
bool ok = IntDivMod(&q, &r, &dvd, 100u);- In
Math.c:3951:
Allocator *a = ALLOCATOR_OF(&dbg);
Int dvd = IntFrom(1003u, a);
Int dvs = IntFrom(100u, a);
Int r = IntFrom(7u, a);- In
Math.c:3952:
Int dvd = IntFrom(1003u, a);
Int dvs = IntFrom(100u, a);
Int r = IntFrom(7u, a);- In
Math.c:3953:
Int dvd = IntFrom(1003u, a);
Int dvs = IntFrom(100u, a);
Int r = IntFrom(7u, a);
bool ok = IntMod(&r, &dvd, &dvs); // int_mod frees quotient on success (1598)
- In
Math.c:3972:
// exponent 13 = 0b1101 hits both the multiply-acc branch (1317) and the
// square-current branch (1331), and final current/acc cleanup (1336).
Int base = IntFrom(3u, a);
Int r = IntFrom(7u, a);- In
Math.c:3973:
// square-current branch (1331), and final current/acc cleanup (1336).
Int base = IntFrom(3u, a);
Int r = IntFrom(7u, a);
bool ok = IntPow(&r, &base, 13u);- In
Math.c:3990:
// Euclid loop frees x each iteration (1657), final y cleanup (1663).
Int x = IntFrom(123456u, a);
Int y = IntFrom(7890u, a);
Int r = IntFrom(7u, a);- In
Math.c:3991:
// Euclid loop frees x each iteration (1657), final y cleanup (1663).
Int x = IntFrom(123456u, a);
Int y = IntFrom(7890u, a);
Int r = IntFrom(7u, a);- In
Math.c:3992:
Int x = IntFrom(123456u, a);
Int y = IntFrom(7890u, a);
Int r = IntFrom(7u, a);
bool ok = IntGCD(&r, &x, &y);- In
Math.c:4010:
// Success path frees gcd + quotient (1689/1690).
Int x = IntFrom(21u, a);
Int y = IntFrom(6u, a);
Int r = IntFrom(7u, a);- In
Math.c:4011:
// Success path frees gcd + quotient (1689/1690).
Int x = IntFrom(21u, a);
Int y = IntFrom(6u, a);
Int r = IntFrom(7u, a);- In
Math.c:4012:
Int x = IntFrom(21u, a);
Int y = IntFrom(6u, a);
Int r = IntFrom(7u, a);
bool ok = IntLCM(&r, &x, &y);- In
Math.c:4031:
// Non-trivial cube root drives the bisection loop: low/high/mid/mid_pow
// deinits (1813,1819,1832,1837,1838), the final block (1855..1858).
Int v = IntFrom(1000000u, a);
Int root = IntFrom(7u, a);
Int rem = IntFrom(9u, a);- In
Math.c:4032:
// deinits (1813,1819,1832,1837,1838), the final block (1855..1858).
Int v = IntFrom(1000000u, a);
Int root = IntFrom(7u, a);
Int rem = IntFrom(9u, a);- In
Math.c:4033:
Int v = IntFrom(1000000u, a);
Int root = IntFrom(7u, a);
Int rem = IntFrom(9u, a);
bool ok = IntRootRem(&root, &rem, &v, 3); // 100^3 = 1e6
- In
Math.c:4051:
// Inexact root exercises the cmp>0 branch (1819/1822/1832 high update).
Int v = IntFrom(1000u, a);
Int root = IntFrom(7u, a);
Int rem = IntFrom(9u, a);- In
Math.c:4052:
// Inexact root exercises the cmp>0 branch (1819/1822/1832 high update).
Int v = IntFrom(1000u, a);
Int root = IntFrom(7u, a);
Int rem = IntFrom(9u, a);- In
Math.c:4053:
Int v = IntFrom(1000u, a);
Int root = IntFrom(7u, a);
Int rem = IntFrom(9u, a);
bool ok = IntRootRem(&root, &rem, &v, 3); // cbrt(1000)=10 exact actually
- In
Math.c:4059:
// and a genuinely inexact one
Int v2 = IntFrom(999u, a);
ok = ok && IntRootRem(&root, &rem, &v2, 3);
ok = ok && IntToU64(&root) == 9u && IntToU64(&rem) == 999u - 729u;- In
Math.c:4076:
Allocator *a = ALLOCATOR_OF(&dbg);
Int v = IntFrom(1000000u, a);
Int r = IntFrom(7u, a);- In
Math.c:4077:
Int v = IntFrom(1000000u, a);
Int r = IntFrom(7u, a);
bool ok = IntRoot(&r, &v, 3); // frees remainder on success (1877)
- In
Math.c:4094:
// Frees root + remainder on success (1904/1905).
Int sq = IntFrom(123201u, a); // 351^2
Int nsq = IntFrom(123202u, a);- In
Math.c:4095:
// Frees root + remainder on success (1904/1905).
Int sq = IntFrom(123201u, a); // 351^2
Int nsq = IntFrom(123202u, a);
bool ok = IntIsPerfectSquare(&sq) && !IntIsPerfectSquare(&nsq);- In
Math.c:4111:
// Loop frees root + remainder each degree (1934/1935).
Int pw = IntFrom(7776u, a); // 6^5
Int npw = IntFrom(7777u, a);- In
Math.c:4112:
// Loop frees root + remainder each degree (1934/1935).
Int pw = IntFrom(7776u, a); // 6^5
Int npw = IntFrom(7777u, a);
bool ok = IntIsPerfectPower(&pw) && !IntIsPerfectPower(&npw);- In
Math.c:4129:
// Drives the main loop (swap, even-stripping 1972, inner deinits) and both
// tail branches: result-1 path (1998) and nn!=1 -> 0 path requires gcd!=1.
Int x = IntFrom(1001u, a);
Int n = IntFrom(9907u, a); // prime
int jr = 0;- In
Math.c:4130:
// tail branches: result-1 path (1998) and nn!=1 -> 0 path requires gcd!=1.
Int x = IntFrom(1001u, a);
Int n = IntFrom(9907u, a); // prime
int jr = 0;- In
Math.c:4136:
// a case where gcd(a,n) != 1 -> the *out=0 branch (frees nn at 1998)
Int x2 = IntFrom(15u, a);
Int n2 = IntFrom(9u, a); // odd, gcd(15,9)=3
int jr2 = 0;- In
Math.c:4137:
// a case where gcd(a,n) != 1 -> the *out=0 branch (frees nn at 1998)
Int x2 = IntFrom(15u, a);
Int n2 = IntFrom(9u, a); // odd, gcd(15,9)=3
int jr2 = 0;
ok = ok && IntTryJacobi(&jr2, &x2, &n2) && jr2 == 0;- In
Math.c:4154:
Allocator *a = ALLOCATOR_OF(&dbg);
Int x = IntFrom(12345u, a);
Int y = IntFrom(67890u, a);
Int m = IntFrom(1009u, a);- In
Math.c:4155:
Int x = IntFrom(12345u, a);
Int y = IntFrom(67890u, a);
Int m = IntFrom(1009u, a);
Int r = IntFrom(7u, a);- In
Math.c:4156:
Int x = IntFrom(12345u, a);
Int y = IntFrom(67890u, a);
Int m = IntFrom(1009u, a);
Int r = IntFrom(7u, a);- In
Math.c:4157:
Int y = IntFrom(67890u, a);
Int m = IntFrom(1009u, a);
Int r = IntFrom(7u, a);
bool ok = IntModAdd(&r, &x, &y, &m); // frees ar/br/sum on success (2042-2044)
- In
Math.c:4176:
// ar >= br branch (2098/2099 frees ar/br).
Int x = IntFrom(900u, a);
Int y = IntFrom(100u, a);
Int m = IntFrom(1009u, a);- In
Math.c:4177:
// ar >= br branch (2098/2099 frees ar/br).
Int x = IntFrom(900u, a);
Int y = IntFrom(100u, a);
Int m = IntFrom(1009u, a);
Int r = IntFrom(7u, a);- In
Math.c:4178:
Int x = IntFrom(900u, a);
Int y = IntFrom(100u, a);
Int m = IntFrom(1009u, a);
Int r = IntFrom(7u, a);- In
Math.c:4179:
Int y = IntFrom(100u, a);
Int m = IntFrom(1009u, a);
Int r = IntFrom(7u, a);
bool ok = IntModSub(&r, &x, &y, &m);- In
Math.c:4198:
// ar < br branch: nonzero diff -> modulus-diff (2095 frees diff).
Int x = IntFrom(100u, a);
Int y = IntFrom(900u, a);
Int m = IntFrom(1009u, a);- In
Math.c:4199:
// ar < br branch: nonzero diff -> modulus-diff (2095 frees diff).
Int x = IntFrom(100u, a);
Int y = IntFrom(900u, a);
Int m = IntFrom(1009u, a);
Int r = IntFrom(7u, a);- In
Math.c:4200:
Int x = IntFrom(100u, a);
Int y = IntFrom(900u, a);
Int m = IntFrom(1009u, a);
Int r = IntFrom(7u, a);- In
Math.c:4201:
Int y = IntFrom(900u, a);
Int m = IntFrom(1009u, a);
Int r = IntFrom(7u, a);
bool ok = IntModSub(&r, &x, &y, &m);- In
Math.c:4225:
// Instead exercise the ar<br with diff==0 by x=0 mod m, y=0 mod m won't.
// Use the generic ar<br path already covered; here cover equal-after-mod.
Int x = IntFrom(5u, a);
Int y = IntFrom(5u, a);
Int m = IntFrom(1009u, a);- In
Math.c:4226:
// Use the generic ar<br path already covered; here cover equal-after-mod.
Int x = IntFrom(5u, a);
Int y = IntFrom(5u, a);
Int m = IntFrom(1009u, a);
Int r = IntFrom(7u, a);- In
Math.c:4227:
Int x = IntFrom(5u, a);
Int y = IntFrom(5u, a);
Int m = IntFrom(1009u, a);
Int r = IntFrom(7u, a);- In
Math.c:4228:
Int y = IntFrom(5u, a);
Int m = IntFrom(1009u, a);
Int r = IntFrom(7u, a);
bool ok = IntModSub(&r, &x, &y, &m);- In
Math.c:4246:
Allocator *a = ALLOCATOR_OF(&dbg);
Int x = IntFrom(12345u, a);
Int y = IntFrom(67890u, a);
Int m = IntFrom(1009u, a);- In
Math.c:4247:
Int x = IntFrom(12345u, a);
Int y = IntFrom(67890u, a);
Int m = IntFrom(1009u, a);
Int r = IntFrom(7u, a);- In
Math.c:4248:
Int x = IntFrom(12345u, a);
Int y = IntFrom(67890u, a);
Int m = IntFrom(1009u, a);
Int r = IntFrom(7u, a);- In
Math.c:4249:
Int y = IntFrom(67890u, a);
Int m = IntFrom(1009u, a);
Int r = IntFrom(7u, a);
bool ok = IntModMul(&r, &x, &y, &m); // frees ar/br/prod (2126-2128)
- In
Math.c:4267:
Allocator *a = ALLOCATOR_OF(&dbg);
Int x = IntFrom(12345u, a);
Int m = IntFrom(1009u, a);
Int r = IntFrom(7u, a);- In
Math.c:4268:
Int x = IntFrom(12345u, a);
Int m = IntFrom(1009u, a);
Int r = IntFrom(7u, a);- In
Math.c:4269:
Int x = IntFrom(12345u, a);
Int m = IntFrom(1009u, a);
Int r = IntFrom(7u, a);
bool ok = IntSquareMod(&r, &x, &m);- In
Math.c:4287:
// IntModDiv frees inverse on success (2160).
Int x = IntFrom(42u, a);
Int y = IntFrom(5u, a);
Int m = IntFrom(1009u, a);- In
Math.c:4288:
// IntModDiv frees inverse on success (2160).
Int x = IntFrom(42u, a);
Int y = IntFrom(5u, a);
Int m = IntFrom(1009u, a);
Int r = IntFrom(7u, a);- In
Math.c:4289:
Int x = IntFrom(42u, a);
Int y = IntFrom(5u, a);
Int m = IntFrom(1009u, a);
Int r = IntFrom(7u, a);- In
Math.c:4290:
Int y = IntFrom(5u, a);
Int m = IntFrom(1009u, a);
Int r = IntFrom(7u, a);
bool ok = IntModDiv(&r, &x, &y, &m);- In
Math.c:4309:
// int_pow_u64_mod: multiply-acc (2201) and square (2215), final cleanup
// (2220 frees base_mod).
Int base = IntFrom(7u, a);
Int m = IntFrom(1000000007u, a);
Int r = IntFrom(9u, a);- In
Math.c:4310:
// (2220 frees base_mod).
Int base = IntFrom(7u, a);
Int m = IntFrom(1000000007u, a);
Int r = IntFrom(9u, a);- In
Math.c:4311:
Int base = IntFrom(7u, a);
Int m = IntFrom(1000000007u, a);
Int r = IntFrom(9u, a);
bool ok = IntPowMod(&r, &base, 13u, &m);- In
Math.c:4329:
// int_pow_mod (Int exponent) main loop + final base_mod/exp cleanup.
Int base = IntFrom(7u, a);
Int exp = IntFrom(13u, a);
Int m = IntFrom(1000000007u, a);- In
Math.c:4330:
// int_pow_mod (Int exponent) main loop + final base_mod/exp cleanup.
Int base = IntFrom(7u, a);
Int exp = IntFrom(13u, a);
Int m = IntFrom(1000000007u, a);
Int r = IntFrom(9u, a);- In
Math.c:4331:
Int base = IntFrom(7u, a);
Int exp = IntFrom(13u, a);
Int m = IntFrom(1000000007u, a);
Int r = IntFrom(9u, a);- In
Math.c:4332:
Int exp = IntFrom(13u, a);
Int m = IntFrom(1000000007u, a);
Int r = IntFrom(9u, a);
bool ok = IntPowMod(&r, &base, &exp, &m);- In
Math.c:4350:
Allocator *a = ALLOCATOR_OF(&dbg);
Int v = IntFrom(17u, a);
Int m = IntFrom(3120u, a); // gcd(17,3120)=1
Int r = IntFrom(7u, a);- In
Math.c:4351:
Int v = IntFrom(17u, a);
Int m = IntFrom(3120u, a); // gcd(17,3120)=1
Int r = IntFrom(7u, a);- In
Math.c:4352:
Int v = IntFrom(17u, a);
Int m = IntFrom(3120u, a); // gcd(17,3120)=1
Int r = IntFrom(7u, a);
bool ok = IntModInv(&r, &v, &m);- In
Math.c:4372:
// t.negative && !zero branch (modulus - mag_mod, frees positive/mag_mod
// and mag_mod at 2414).
Int v = IntFrom(3u, a);
Int m = IntFrom(7u, a); // inverse of 3 mod 7 is 5
Int r = IntFrom(9u, a);- In
Math.c:4373:
// and mag_mod at 2414).
Int v = IntFrom(3u, a);
Int m = IntFrom(7u, a); // inverse of 3 mod 7 is 5
Int r = IntFrom(9u, a);- In
Math.c:4374:
Int v = IntFrom(3u, a);
Int m = IntFrom(7u, a); // inverse of 3 mod 7 is 5
Int r = IntFrom(9u, a);
bool ok = IntModInv(&r, &v, &m);- In
Math.c:4394:
// false; the function still frees reduced/r/new_r/one/t/new_t at the tail
// (2419-2424). All those carry allocations.
Int v = IntFrom(6u, a);
Int m = IntFrom(9u, a); // gcd(6,9)=3, no inverse
Int r = IntFrom(7u, a);- In
Math.c:4395:
// (2419-2424). All those carry allocations.
Int v = IntFrom(6u, a);
Int m = IntFrom(9u, a); // gcd(6,9)=3, no inverse
Int r = IntFrom(7u, a);- In
Math.c:4396:
Int v = IntFrom(6u, a);
Int m = IntFrom(9u, a); // gcd(6,9)=3, no inverse
Int r = IntFrom(7u, a);
bool ok = !IntModInv(&r, &v, &m); // returns false
- In
Math.c:4413:
// modulus 7 (7 % 4 == 3) drives the fast path: frees exponent + a (2488/2489).
Int v = IntFrom(2u, a); // 2 is QR mod 7 (3^2=2)
Int m = IntFrom(7u, a);
Int r = IntFrom(9u, a);- In
Math.c:4414:
// modulus 7 (7 % 4 == 3) drives the fast path: frees exponent + a (2488/2489).
Int v = IntFrom(2u, a); // 2 is QR mod 7 (3^2=2)
Int m = IntFrom(7u, a);
Int r = IntFrom(9u, a);- In
Math.c:4415:
Int v = IntFrom(2u, a); // 2 is QR mod 7 (3^2=2)
Int m = IntFrom(7u, a);
Int r = IntFrom(9u, a);
bool ok = IntModSqrt(&r, &v, &m);- In
Math.c:4436:
// the witness-search loop, the t-loop with t_power/b/b_sq, and the success
// int_replace path (2724-2735). 2 is a QR mod 17 (6^2=36=2).
Int v = IntFrom(2u, a);
Int m = IntFrom(17u, a);
Int r = IntFrom(9u, a);- In
Math.c:4437:
// int_replace path (2724-2735). 2 is a QR mod 17 (6^2=36=2).
Int v = IntFrom(2u, a);
Int m = IntFrom(17u, a);
Int r = IntFrom(9u, a);- In
Math.c:4438:
Int v = IntFrom(2u, a);
Int m = IntFrom(17u, a);
Int r = IntFrom(9u, a);
bool ok = IntModSqrt(&r, &v, &m);- In
Math.c:4458:
// modulus 41 (41 % 4 == 1, 41-1 = 40 = 8*5 so m=3 levels) drives the inner
// b-squaring loop (2662) and the c/t/b reassignments more deeply.
Int v = IntFrom(10u, a); // 10 is QR mod 41 (16^2=256=256-246=10)
Int m = IntFrom(41u, a);
Int r = IntFrom(9u, a);- In
Math.c:4459:
// b-squaring loop (2662) and the c/t/b reassignments more deeply.
Int v = IntFrom(10u, a); // 10 is QR mod 41 (16^2=256=256-246=10)
Int m = IntFrom(41u, a);
Int r = IntFrom(9u, a);- In
Math.c:4460:
Int v = IntFrom(10u, a); // 10 is QR mod 41 (16^2=256=256-246=10)
Int m = IntFrom(41u, a);
Int r = IntFrom(9u, a);
bool ok = IntModSqrt(&r, &v, &m);- In
Math.c:4479:
// value % modulus == 0 -> zero branch frees a (2449).
Int v = IntFrom(0u, a);
Int m = IntFrom(17u, a);
Int r = IntFrom(9u, a);- In
Math.c:4480:
// value % modulus == 0 -> zero branch frees a (2449).
Int v = IntFrom(0u, a);
Int m = IntFrom(17u, a);
Int r = IntFrom(9u, a);- In
Math.c:4481:
Int v = IntFrom(0u, a);
Int m = IntFrom(17u, a);
Int r = IntFrom(9u, a);
bool ok = IntModSqrt(&r, &v, &m) && IntIsZero(&r);- In
Math.c:4499:
// modulus 2 path: int_replace(result, &a) (no extra deinit, but reaches
// the compare-u64==2 branch); a is moved into result.
Int v = IntFrom(1u, a);
Int m = IntFrom(2u, a);
Int r = IntFrom(9u, a);- In
Math.c:4500:
// the compare-u64==2 branch); a is moved into result.
Int v = IntFrom(1u, a);
Int m = IntFrom(2u, a);
Int r = IntFrom(9u, a);- In
Math.c:4501:
Int v = IntFrom(1u, a);
Int m = IntFrom(2u, a);
Int r = IntFrom(9u, a);
bool ok = IntModSqrt(&r, &v, &m) && IntToU64(&r) == 1u;- In
Math.c:4519:
// jacobi != 1 -> non-residue, frees a and returns false (2473's deinit at
// the early non-residue return). 3 is a non-residue mod 7.
Int v = IntFrom(3u, a);
Int m = IntFrom(7u, a);
Int r = IntFrom(9u, a);- In
Math.c:4520:
// the early non-residue return). 3 is a non-residue mod 7.
Int v = IntFrom(3u, a);
Int m = IntFrom(7u, a);
Int r = IntFrom(9u, a);- In
Math.c:4521:
Int v = IntFrom(3u, a);
Int m = IntFrom(7u, a);
Int r = IntFrom(9u, a);
bool ok = !IntModSqrt(&r, &v, &m);- In
Math.c:4538:
// composite (non-prime) odd modulus -> !prime branch frees a (2465).
Int v = IntFrom(2u, a);
Int m = IntFrom(9u, a); // odd composite
Int r = IntFrom(9u, a);- In
Math.c:4539:
// composite (non-prime) odd modulus -> !prime branch frees a (2465).
Int v = IntFrom(2u, a);
Int m = IntFrom(9u, a); // odd composite
Int r = IntFrom(9u, a);- In
Math.c:4540:
Int v = IntFrom(2u, a);
Int m = IntFrom(9u, a); // odd composite
Int r = IntFrom(9u, a);
bool ok = !IntModSqrt(&r, &v, &m);- In
Math.c:4557:
// even modulus (>2) -> IntIsEven branch frees a (2465).
Int v = IntFrom(3u, a);
Int m = IntFrom(8u, a);
Int r = IntFrom(9u, a);- In
Math.c:4558:
// even modulus (>2) -> IntIsEven branch frees a (2465).
Int v = IntFrom(3u, a);
Int m = IntFrom(8u, a);
Int r = IntFrom(9u, a);- In
Math.c:4559:
Int v = IntFrom(3u, a);
Int m = IntFrom(8u, a);
Int r = IntFrom(9u, a);
bool ok = !IntModSqrt(&r, &v, &m);- In
Math.c:4579:
// witness inner loop (2839), per-iteration base/x (2853/2854), and the d /
// n_minus_one tail (2860/2861).
Int prime = IntFrom(1000003u, a); // prime
Int composite = IntFrom(1000005u, a); // composite
- In
Math.c:4580:
// n_minus_one tail (2860/2861).
Int prime = IntFrom(1000003u, a); // prime
Int composite = IntFrom(1000005u, a); // composite
bool ok = IntIsProbablePrime(&prime) && !IntIsProbablePrime(&composite);- In
Math.c:4598:
// (squaring x repeatedly) before failing. 2047 = 23*89 passes base 2 (it's
// a 2-SPRP) but fails on another base -> exercises x squaring (2839).
Int n = IntFrom(2047u, a);
bool ok = !IntIsProbablePrime(&n);- In
Math.c:4614:
// Drives candidate-stepping loop (frees candidate on success at 2924, and
// the +2 stepping at 2918). Starting from an even-ish composite.
Int v = IntFrom(1000000u, a);
Int r = IntFrom(7u, a);- In
Math.c:4615:
// the +2 stepping at 2918). Starting from an even-ish composite.
Int v = IntFrom(1000000u, a);
Int r = IntFrom(7u, a);
bool ok = IntNextPrime(&r, &v);- In
Math.c:4633:
// value <= 1 -> two path (2879 int_replace) and the candidate<=2 path
// (2902/2903 frees candidate then replaces with two).
Int v0 = IntFrom(0u, a);
Int r0 = IntFrom(7u, a);
Int v1 = IntFrom(2u, a);- In
Math.c:4634:
// (2902/2903 frees candidate then replaces with two).
Int v0 = IntFrom(0u, a);
Int r0 = IntFrom(7u, a);
Int v1 = IntFrom(2u, a);
Int r1 = IntFrom(7u, a);- In
Math.c:4635:
Int v0 = IntFrom(0u, a);
Int r0 = IntFrom(7u, a);
Int v1 = IntFrom(2u, a);
Int r1 = IntFrom(7u, a);- In
Math.c:4636:
Int r0 = IntFrom(7u, a);
Int v1 = IntFrom(2u, a);
Int r1 = IntFrom(7u, a);
bool ok = IntNextPrime(&r0, &v0) && IntToU64(&r0) == 2u;- In
Math.c:4654:
Allocator *a = ALLOCATOR_OF(&dbg);
Int x = IntFrom(123456u, a);
Int y = IntFrom(7891011u, a);
Int r = IntFrom(0xDEADBEEFu, a); // pre-populated: holds a live buffer
- In
Math.c:4655:
Int x = IntFrom(123456u, a);
Int y = IntFrom(7891011u, a);
Int r = IntFrom(0xDEADBEEFu, a); // pre-populated: holds a live buffer
- In
Math.c:4656:
Int x = IntFrom(123456u, a);
Int y = IntFrom(7891011u, a);
Int r = IntFrom(0xDEADBEEFu, a); // pre-populated: holds a live buffer
bool ok = IntMul(&r, &x, &y);- In
Math.c:4673:
Allocator *a = ALLOCATOR_OF(&dbg);
Int dvd = IntFrom(1000u, a);
Int r = IntFrom(7u, a);- In
Math.c:4674:
Int dvd = IntFrom(1000u, a);
Int r = IntFrom(7u, a);
bool ok = IntDivExact(&r, &dvd, (i64)8);- In
Math.c:4703:
for (u64 si = 0; si < samples && ok; si++) {
u64 vv = 1u + (si * (p - 2u)) / (samples - 1u);
Int v = IntFrom(vv, a);
Int m = IntFrom(p, a);
Int r = IntFrom(9u, a);- In
Math.c:4704:
u64 vv = 1u + (si * (p - 2u)) / (samples - 1u);
Int v = IntFrom(vv, a);
Int m = IntFrom(p, a);
Int r = IntFrom(9u, a);- In
Math.c:4705:
Int v = IntFrom(vv, a);
Int m = IntFrom(p, a);
Int r = IntFrom(9u, a);
bool found = IntModSqrt(&r, &v, &m);- In
Math.c:4728:
Allocator *alloc = ALLOCATOR_OF(&dbg);
Int value = IntFrom(7u, alloc);
Int modulus = IntFrom(40u, alloc); // 7 * 23 = 161 = 1 (mod 40)
Int inverse = IntFrom(0u, alloc);- In
Math.c:4729:
Int value = IntFrom(7u, alloc);
Int modulus = IntFrom(40u, alloc); // 7 * 23 = 161 = 1 (mod 40)
Int inverse = IntFrom(0u, alloc);- In
Math.c:4730:
Int value = IntFrom(7u, alloc);
Int modulus = IntFrom(40u, alloc); // 7 * 23 = 161 = 1 (mod 40)
Int inverse = IntFrom(0u, alloc);
bool ok = IntModInv(&inverse, &value, &modulus);- In
Math.c:4748:
Allocator *alloc = ALLOCATOR_OF(&dbg);
Int value = IntFrom(9u, alloc);
Int modulus = IntFrom(41u, alloc); // 41-1 = 8*5 -> several Tonelli rounds
Int root = IntFrom(0u, alloc);- In
Math.c:4749:
Int value = IntFrom(9u, alloc);
Int modulus = IntFrom(41u, alloc); // 41-1 = 8*5 -> several Tonelli rounds
Int root = IntFrom(0u, alloc);
Int check = IntFrom(0u, alloc);- In
Math.c:4750:
Int value = IntFrom(9u, alloc);
Int modulus = IntFrom(41u, alloc); // 41-1 = 8*5 -> several Tonelli rounds
Int root = IntFrom(0u, alloc);
Int check = IntFrom(0u, alloc);- In
Math.c:4751:
Int modulus = IntFrom(41u, alloc); // 41-1 = 8*5 -> several Tonelli rounds
Int root = IntFrom(0u, alloc);
Int check = IntFrom(0u, alloc);
bool ok = IntModSqrt(&root, &value, &modulus);- In
Math.c:4771:
Allocator *alloc = ALLOCATOR_OF(&dbg);
Int value = IntFrom(2u, alloc);
Int modulus = IntFrom(7u, alloc); // 7 % 4 == 3
Int root = IntFrom(0u, alloc);- In
Math.c:4772:
Int value = IntFrom(2u, alloc);
Int modulus = IntFrom(7u, alloc); // 7 % 4 == 3
Int root = IntFrom(0u, alloc);
Int check = IntFrom(0u, alloc);- In
Math.c:4773:
Int value = IntFrom(2u, alloc);
Int modulus = IntFrom(7u, alloc); // 7 % 4 == 3
Int root = IntFrom(0u, alloc);
Int check = IntFrom(0u, alloc);- In
Math.c:4774:
Int modulus = IntFrom(7u, alloc); // 7 % 4 == 3
Int root = IntFrom(0u, alloc);
Int check = IntFrom(0u, alloc);
bool ok = IntModSqrt(&root, &value, &modulus);- In
Math.c:4794:
Allocator *alloc = ALLOCATOR_OF(&dbg);
Int m = IntFrom(7u, alloc);
Int r = IntFrom(0u, alloc);- In
Math.c:4795:
Int m = IntFrom(7u, alloc);
Int r = IntFrom(0u, alloc);
// ar >= br branch: 5 - 2 = 3 (mod 7)
- In
Math.c:4798:
// ar >= br branch: 5 - 2 = 3 (mod 7)
Int a1 = IntFrom(5u, alloc), b1 = IntFrom(2u, alloc);
bool ok = IntModSub(&r, &a1, &b1, &m) && IntCompare(&r, 3u) == 0;
// ar < br branch: 2 - 5 = -3 = 4 (mod 7)
- In
Math.c:4801:
bool ok = IntModSub(&r, &a1, &b1, &m) && IntCompare(&r, 3u) == 0;
// ar < br branch: 2 - 5 = -3 = 4 (mod 7)
Int a2 = IntFrom(2u, alloc), b2 = IntFrom(5u, alloc);
ok = ok && IntModSub(&r, &a2, &b2, &m) && IntCompare(&r, 4u) == 0;
// equal branch: 5 - 12 = 0 (mod 7)
- In
Math.c:4804:
ok = ok && IntModSub(&r, &a2, &b2, &m) && IntCompare(&r, 4u) == 0;
// equal branch: 5 - 12 = 0 (mod 7)
Int a3 = IntFrom(5u, alloc), b3 = IntFrom(12u, alloc);
ok = ok && IntModSub(&r, &a3, &b3, &m) && IntIsZero(&r);- In
Math.c:4825:
Allocator *alloc = ALLOCATOR_OF(&dbg);
Int value = IntFrom(100u, alloc);
Int next = IntFrom(0u, alloc);- In
Math.c:4826:
Int value = IntFrom(100u, alloc);
Int next = IntFrom(0u, alloc);
bool ok = IntNextPrime(&next, &value);- In
Math.c:4843:
Allocator *alloc = ALLOCATOR_OF(&dbg);
Int value = IntFrom(561u, alloc);
bool error = false;
bool prime = IntIsProbablePrime(&value, &error);- In
Convert.c:94:
bool test_int_from_unsigned_integer(void) {
WriteFmt("Testing IntFrom with unsigned integer\n");
DefaultAllocator alloc = DefaultAllocatorInit();- In
Convert.c:98:
DefaultAllocator alloc = DefaultAllocatorInit();
Int value = IntFrom(13, ALLOCATOR_OF(&alloc));
Str text = IntToBinary(&value);- In
Convert.c:209:
DefaultAllocator alloc = DefaultAllocatorInit();
Int value = IntFrom(0xBEEF, ALLOCATOR_OF(&alloc));
Str text = IntToStrRadix(&value, 16, true);- In
Convert.c:233:
alloc.base.retry_limit = 4;
Int value = IntFrom(0xBEEF, ALLOCATOR_OF(&alloc));
ok = int_try_to_str_radix(&text, &value, 16, true, ALLOCATOR_OF(&alloc));- In
Convert.c:253:
Int lhs = IntFromBinary("0001011", ALLOCATOR_OF(&alloc));
Int rhs = IntFrom(11, ALLOCATOR_OF(&alloc));
bool result = IntCompare(&lhs, &rhs) == 0;- In
Convert.c:429:
DefaultAllocator alloc = DefaultAllocatorInit();
Int value = IntFrom(1, ALLOCATOR_OF(&alloc));
u64 out = 0;
bool error = false;- In
Convert.c:450:
DefaultAllocator alloc = DefaultAllocatorInit();
Int value = IntFrom(255, ALLOCATOR_OF(&alloc));
Str text = IntToStrRadix(&value, 37, false);- In
Convert.c:586:
DefaultAllocator alloc = DefaultAllocatorInit();
Int value = IntFrom(1, ALLOCATOR_OF(&alloc));
IntToBytesLE(&value, NULL, 1);
DefaultAllocatorDeinit(&alloc);- In
Convert.c:597:
DefaultAllocator alloc = DefaultAllocatorInit();
Int value = IntFrom(1, ALLOCATOR_OF(&alloc));
u8 byte = 0;- In
Convert.c:616:
DefaultAllocator alloc = DefaultAllocatorInit();
Int a = IntFrom((u64)13u, &alloc.base);
Int b = IntFrom((u64)21u, &alloc.base);
Int product = IntInit(&alloc.base);- In
Convert.c:617:
Int a = IntFrom((u64)13u, &alloc.base);
Int b = IntFrom((u64)21u, &alloc.base);
Int product = IntInit(&alloc.base);- In
Convert.c:890:
DefaultAllocator alloc = DefaultAllocatorInit();
Int small = IntFrom(7u, &alloc.base);
Int mid = IntFrom(255u, &alloc.base);
Int big = IntFromStr("123456789012345678901234567890", &alloc.base);- In
Convert.c:891:
Int small = IntFrom(7u, &alloc.base);
Int mid = IntFrom(255u, &alloc.base);
Int big = IntFromStr("123456789012345678901234567890", &alloc.base);- In
Convert.c:1112:
DefaultAllocator alloc = DefaultAllocatorInit();
Int value = IntFrom(0x1234, ALLOCATOR_OF(&alloc));
u8 out[8] = {0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA};
u64 written = IntToBytesLE(&value, out, sizeof(out));- In
Convert.c:1137:
DefaultAllocator alloc = DefaultAllocatorInit();
Int value = IntFrom(1, ALLOCATOR_OF(&alloc));
u8 out[4] = {0xAA, 0xAA, 0xAA, 0xAA};
u64 written = IntToBytesLE(&value, out, sizeof(out));- In
Convert.c:1159:
DefaultAllocator alloc = DefaultAllocatorInit();
Int value = IntFrom(0x1234, ALLOCATOR_OF(&alloc));
u8 out[8] = {0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA};
u64 written = IntToBytesBE(&value, out, sizeof(out));- In
Convert.c:1184:
DefaultAllocator alloc = DefaultAllocatorInit();
Int value = IntFrom(1, ALLOCATOR_OF(&alloc));
u8 out[4] = {0xAA, 0xAA, 0xAA, 0xAA};
u64 written = IntToBytesBE(&value, out, sizeof(out));- In
Convert.c:1306:
DefaultAllocator alloc = DefaultAllocatorInit();
Int a = IntFrom(1, &alloc.base);
Int b = IntFrom(257, &alloc.base);- In
Convert.c:1307:
Int a = IntFrom(1, &alloc.base);
Int b = IntFrom(257, &alloc.base);
u64 ha = int_hash(&a, 0);- In
Convert.c:1551:
DefaultAllocator alloc = DefaultAllocatorInit();
Int value = IntFrom(0x0102, &alloc.base);
u8 buf[4];
MemSet(buf, 0xAA, sizeof(buf));- In
Convert.c:1572:
// Drives int_try_to_str_radix loop (760, 772) and int_div_u64_rem
// (1583/1584) and int_mod_u64 (1630).
Int v = IntFrom(1234567u, a);
Str s = IntToStrRadix(&v, 10, false, a);
bool ok = StrLen(&s) == 7;- In
Convert.c:1609:
Allocator *a = ALLOCATOR_OF(&dbg);
Int out = IntFrom(987654321u, a); // pre-populated: holds a live buffer
bool ok = IntTryFromStr(&out, "123456789");- In
Access.c:61:
Int zero = IntInit(&alloc.base);
Int non_zero = IntFrom(1, &alloc.base);
bool result = IntIsZero(&zero);- In
Access.c:77:
DefaultAllocator alloc = DefaultAllocatorInit();
Int one = IntFrom(1, &alloc.base);
Int two = IntFrom(2, &alloc.base);- In
Access.c:78:
Int one = IntFrom(1, &alloc.base);
Int two = IntFrom(2, &alloc.base);
bool result = IntIsOne(&one);- In
Access.c:94:
DefaultAllocator alloc = DefaultAllocatorInit();
Int even = IntFrom(42, &alloc.base);
Int odd = IntFrom(43, &alloc.base);- In
Access.c:95:
Int even = IntFrom(42, &alloc.base);
Int odd = IntFrom(43, &alloc.base);
bool result = IntIsEven(&even);- In
Access.c:113:
DefaultAllocator alloc = DefaultAllocatorInit();
Int small = IntFrom(UINT64_MAX, &alloc.base);
Int big = IntFrom(1, &alloc.base);- In
Access.c:114:
Int small = IntFrom(UINT64_MAX, &alloc.base);
Int big = IntFrom(1, &alloc.base);
IntShiftLeft(&big, 64);- In
Access.c:132:
DefaultAllocator alloc = DefaultAllocatorInit();
Int value = IntFrom(1025, &alloc.base);
bool error = true;- In
Access.c:165:
DefaultAllocator alloc = DefaultAllocatorInit();
Int one = IntFrom(1, &alloc.base);
Int power = IntFrom(1, &alloc.base);
Int other = IntFrom(24, &alloc.base);- In
Access.c:166:
Int one = IntFrom(1, &alloc.base);
Int power = IntFrom(1, &alloc.base);
Int other = IntFrom(24, &alloc.base);
Int zero = IntInit(&alloc.base);- In
Access.c:167:
Int one = IntFrom(1, &alloc.base);
Int power = IntFrom(1, &alloc.base);
Int other = IntFrom(24, &alloc.base);
Int zero = IntInit(&alloc.base);- In
Access.c:210:
DefaultAllocator alloc = DefaultAllocatorInit();
Int value = IntFrom(12345, &alloc.base);
Int root = IntFrom(99, &alloc.base);
Int remainder = IntFrom(77, &alloc.base);- In
Access.c:211:
Int value = IntFrom(12345, &alloc.base);
Int root = IntFrom(99, &alloc.base);
Int remainder = IntFrom(77, &alloc.base);- In
Access.c:212:
Int value = IntFrom(12345, &alloc.base);
Int root = IntFrom(99, &alloc.base);
Int remainder = IntFrom(77, &alloc.base);
bool ok = IntRootRem(&root, &remainder, &value, 1);- In
Access.c:234:
DefaultAllocator alloc = DefaultAllocatorInit();
Int value = IntFrom(0, &alloc.base);
u64 h = int_hash(&value, 0);- In
Access.c:253:
DefaultAllocator alloc = DefaultAllocatorInit();
Int value = IntFrom(255, &alloc.base);
u64 expected = 1469598103934665603ULL;- In
Access.c:275:
DefaultAllocator alloc = DefaultAllocatorInit();
Int value = IntFrom(5, &alloc.base);
bool ok = IntShiftRight(&value, 0);- In
Access.c:298:
DefaultAllocator alloc = DefaultAllocatorInit();
Int value = IntFrom(7u, &alloc.base);
bool ok = IntShiftLeft(&value, 0);- In
Access.c:319:
DefaultAllocator alloc = DefaultAllocatorInit();
Int value = IntFrom((u64)40u, &alloc.base);
bool result = (IntBitLength(&value) == 6u);- In
Access.c:355:
DefaultAllocator alloc = DefaultAllocatorInit();
Int base = IntFrom(7, &alloc.base);
Int mod = IntFrom(13, &alloc.base);
Int result_value = IntInit(&alloc.base);- In
Access.c:356:
Int base = IntFrom(7, &alloc.base);
Int mod = IntFrom(13, &alloc.base);
Int result_value = IntInit(&alloc.base);- In
Write.c:604:
Int hex_val = IntFromHexStr("deadbeefcafebabe1234", alloc_base);
Int bin_val = IntFromBinary("10100011", alloc_base);
Int oct_val = IntFrom(493, alloc_base);
StrAppendFmt(&output, "{}", big_dec);- In
Write.c:3229:
Str output = StrInit(&alloc);
Int a = IntFrom(0x41, alloc_base); // 'A'
bool success = true;- In
Write.c:3248:
Str output = StrInit(&alloc);
Int a = IntFrom(0x7a, alloc_base); // 'z'
bool success = true;- In
Write.c:3273:
Str output = StrInit(&alloc);
Int seven = IntFrom(7, alloc_base);
bool success = true;- In
Write.c:5449:
Allocator *ab = ALLOCATOR_OF(&alloc);
Str out = StrInit(&alloc);
Int v = IntFrom(42, ab);
StrAppendFmt(&out, "{}", v);
bool ok = (ZstrCompare(StrBegin(&out), "42") == 0);- In
Read.c:2612:
static bool test_read_int_underscore_rejected(void) {
DefaultAllocator alloc = DefaultAllocatorInit();
Int v = IntFrom(777, &alloc.base);
Zstr z = "12_3";
Zstr out = str_read_fmt(z, "{}", (TypeSpecificIO[]) {TO_TYPE_SPECIFIC_IO(Int, &v)}, 1);
Last updated on