Skip to content

IntAllocator

Description

Allocator backing the integer’s storage.

Parameters

Name Direction Description
value in Integer to query.

Usage example (Cross-references)

Usage examples (Cross-references)
        }
    
        Str  temp   = StrInitFromCstr(start, StrIterIndex(&si) - StrIterIndex(&saved), IntAllocator(value));
        Int  parsed = IntInit(IntAllocator(value));
        bool ok     = IntTryFromStrRadix(&parsed, StrBegin(&temp), radix);
    
        Str  temp   = StrInitFromCstr(start, StrIterIndex(&si) - StrIterIndex(&saved), IntAllocator(value));
        Int  parsed = IntInit(IntAllocator(value));
        bool ok     = IntTryFromStrRadix(&parsed, StrBegin(&temp), radix);
    
        ValidateInt(value);
        *out = FloatInit(IntAllocator(value));
        if (!IntTryClone(&out->significand, value)) {
            FloatDeinit(out);
        if (!IntTryClone(&out->significand, value)) {
            FloatDeinit(out);
            *out = FloatInit(IntAllocator(value));
            return false;
        }
        ValidateInt(value);
        (void)alloc;
        result = FloatInit(IntAllocator(value));
        (void)float_try_from_int_value(&result, value);
        float_normalize(&result);
        ValidateFloat(value);
    
        Int temp = IntInit(IntAllocator(result));
    
        if (FloatIsNegative(value)) {
    
    static bool sint_add(SignedInt *result, SignedInt *a, SignedInt *b) {
        SignedInt temp = sint_init(IntAllocator(&result->magnitude));
    
        if (a->negative == b->negative) {
    
    static bool sint_mul_unsigned(SignedInt *result, SignedInt *a, Int *b) {
        SignedInt temp = sint_init(IntAllocator(&result->magnitude));
    
        if (!int_mul(&temp.magnitude, &a->magnitude, b)) {
        Int lhs;
        Int rhs;
        Int result = IntInit(IntAllocator(value));
    
        if (!int_try_clone_value(&lhs, value)) {
            return false;
        }
        if (!int_try_from_u64(&rhs, factor, IntAllocator(value))) {
            IntDeinit(&lhs);
            return false;
        Int lhs;
        Int rhs;
        Int result = IntInit(IntAllocator(value));
    
        if (!int_try_clone_value(&lhs, value)) {
            return false;
        }
        if (!int_try_from_u64(&rhs, addend, IntAllocator(value))) {
            IntDeinit(&lhs);
            return false;
    
        ValidateInt(out);
        result = IntInit(IntAllocator(out));
    
        if (!int_validate_radix(radix)) {
    
        ValidateInt(value);
        *out = IntInit(IntAllocator(value));
        if (!BitVecTryClone(INT_BITS(out), INT_BITS(value))) {
            return false;
    
        ValidateInt(value);
        clone = IntInit(IntAllocator(value));
        (void)int_try_clone_value(&clone, value);
        return clone;
        bool carry = false;
    
        if (!int_try_init_with_capacity(&temp, max_bits + 1, IntAllocator(result))) {
            return false;
        }
        bool borrow = false;
    
        if (!int_try_init_with_capacity(&temp, a_bits, IntAllocator(result))) {
            return false;
        }
        bool ok = false;
    
        if (!int_try_from_u64(&rhs, subtrahend, IntAllocator(value))) {
            return false;
        }
    
        u64 b_bits = IntBitLength(b);
        Int acc    = IntInit(IntAllocator(result));
    
        if (IntIsZero(a) || IntIsZero(b)) {
    
            Int partial;
            Int next = IntInit(IntAllocator(result));
    
            if (!int_try_clone_value(&partial, a)) {
        Int current;
    
        if (!int_try_from_u64(&acc, 1, IntAllocator(result))) {
            return false;
        }
        while (exponent > 0) {
            if (exponent & 1u) {
                Int next = IntInit(IntAllocator(result));
    
                if (!int_mul(&next, &acc, &current)) {
            exponent >>= 1u;
            if (exponent > 0) {
                Int next = IntInit(IntAllocator(result));
    
                if (!IntSquare(&next, &current)) {
        }
    
        Int  normalized_dividend = IntInit(IntAllocator(quotient));
        Int  normalized_divisor  = IntInit(IntAllocator(quotient));
        Int  q                   = IntInit(IntAllocator(quotient));
    
        Int  normalized_dividend = IntInit(IntAllocator(quotient));
        Int  normalized_divisor  = IntInit(IntAllocator(quotient));
        Int  q                   = IntInit(IntAllocator(quotient));
        Int  r                   = IntInit(IntAllocator(remainder));
        Int  normalized_dividend = IntInit(IntAllocator(quotient));
        Int  normalized_divisor  = IntInit(IntAllocator(quotient));
        Int  q                   = IntInit(IntAllocator(quotient));
        Int  r                   = IntInit(IntAllocator(remainder));
        bool ok                  = false;
        Int  normalized_divisor  = IntInit(IntAllocator(quotient));
        Int  q                   = IntInit(IntAllocator(quotient));
        Int  r                   = IntInit(IntAllocator(remainder));
        bool ok                  = false;
    
            IntDeinit(&q);
            if (!int_try_init_with_capacity(&q, dividend_bits - divisor_bits + 1, IntAllocator(quotient))) {
                goto cleanup;
            }
            for (u64 shift = dividend_bits - divisor_bits + 1; shift > 0; shift--) {
                u64 bit     = shift - 1;
                Int shifted = IntInit(IntAllocator(quotient));
    
                if (!int_try_clone_value(&shifted, &normalized_divisor) || !IntShiftLeft(&shifted, bit)) {
    
                if (IntGE(&r, &shifted)) {
                    Int next = IntInit(IntAllocator(quotient));
    
                    if (!int_sub(&next, &r, &shifted)) {
        } else {
            IntDeinit(&q);
            q = IntInit(IntAllocator(quotient));
        }
    
    bool int_div(Int *result, const Int *dividend, const Int *divisor) {
        Int quotient  = IntInit(IntAllocator(result));
        Int remainder = IntInit(IntAllocator(result));
    bool int_div(Int *result, const Int *dividend, const Int *divisor) {
        Int quotient  = IntInit(IntAllocator(result));
        Int remainder = IntInit(IntAllocator(result));
    
        if (!int_div_mod(&quotient, &remainder, dividend, divisor)) {
        }
    
        Int quotient  = IntInit(IntAllocator(result));
        Int remainder = IntInit(IntAllocator(result));
    
        Int quotient  = IntInit(IntAllocator(result));
        Int remainder = IntInit(IntAllocator(result));
    
        if (!int_div_mod(&quotient, &remainder, dividend, divisor)) {
    
    bool int_div_u64(Int *result, const Int *dividend, u64 divisor) {
        Int divisor_value = IntInit(IntAllocator(dividend));
    
        if (!int_try_from_u64(&divisor_value, divisor, IntAllocator(dividend))) {
        Int divisor_value = IntInit(IntAllocator(dividend));
    
        if (!int_try_from_u64(&divisor_value, divisor, IntAllocator(dividend))) {
            IntDeinit(&divisor_value);
            return false;
    
    bool int_div_i64(Int *result, const Int *dividend, i64 divisor) {
        Int divisor_value = IntInit(IntAllocator(dividend));
    
        if (!int_try_from_i64_with_allocator(&divisor_value, divisor, IntAllocator(dividend))) {
        Int divisor_value = IntInit(IntAllocator(dividend));
    
        if (!int_try_from_i64_with_allocator(&divisor_value, divisor, IntAllocator(dividend))) {
            IntDeinit(&divisor_value);
            return false;
    
    bool int_div_exact_u64(Int *result, const Int *dividend, u64 divisor) {
        Int divisor_value = IntInit(IntAllocator(dividend));
    
        if (!int_try_from_u64(&divisor_value, divisor, IntAllocator(dividend))) {
        Int divisor_value = IntInit(IntAllocator(dividend));
    
        if (!int_try_from_u64(&divisor_value, divisor, IntAllocator(dividend))) {
            IntDeinit(&divisor_value);
            return false;
    
    bool int_div_exact_i64(Int *result, const Int *dividend, i64 divisor) {
        Int divisor_value = IntInit(IntAllocator(dividend));
    
        if (!int_try_from_i64_with_allocator(&divisor_value, divisor, IntAllocator(dividend))) {
        Int divisor_value = IntInit(IntAllocator(dividend));
    
        if (!int_try_from_i64_with_allocator(&divisor_value, divisor, IntAllocator(dividend))) {
            IntDeinit(&divisor_value);
            return false;
    
    bool int_div_mod_u64(Int *quotient, Int *remainder, const Int *dividend, u64 divisor) {
        Int divisor_value = IntInit(IntAllocator(dividend));
    
        if (!int_try_from_u64(&divisor_value, divisor, IntAllocator(dividend))) {
        Int divisor_value = IntInit(IntAllocator(dividend));
    
        if (!int_try_from_u64(&divisor_value, divisor, IntAllocator(dividend))) {
            IntDeinit(&divisor_value);
            return false;
    
    bool int_div_mod_i64(Int *quotient, Int *remainder, const Int *dividend, i64 divisor) {
        Int divisor_value = IntInit(IntAllocator(dividend));
    
        if (!int_try_from_i64_with_allocator(&divisor_value, divisor, IntAllocator(dividend))) {
        Int divisor_value = IntInit(IntAllocator(dividend));
    
        if (!int_try_from_i64_with_allocator(&divisor_value, divisor, IntAllocator(dividend))) {
            IntDeinit(&divisor_value);
            return false;
        }
    
        Int divisor_value = IntInit(IntAllocator(dividend));
        Int remainder     = IntInit(IntAllocator(quotient));
        u64 rem           = 0;
    
        Int divisor_value = IntInit(IntAllocator(dividend));
        Int remainder     = IntInit(IntAllocator(quotient));
        u64 rem           = 0;
        u64 rem           = 0;
    
        if (!int_try_from_u64(&divisor_value, divisor, IntAllocator(dividend))) {
            IntDeinit(&divisor_value);
            IntDeinit(&remainder);
    
    bool int_mod(Int *result, const Int *dividend, const Int *divisor) {
        Int quotient  = IntInit(IntAllocator(result));
        Int remainder = IntInit(IntAllocator(result));
    bool int_mod(Int *result, const Int *dividend, const Int *divisor) {
        Int quotient  = IntInit(IntAllocator(result));
        Int remainder = IntInit(IntAllocator(result));
    
        if (!int_div_mod(&quotient, &remainder, dividend, divisor)) {
    
    bool int_mod_u64_into(Int *result, const Int *dividend, u64 divisor) {
        Int quotient = IntInit(IntAllocator(result));
    
        bool ok = int_div_mod_u64(&quotient, result, dividend, divisor);
    
    bool int_mod_i64_into(Int *result, const Int *dividend, i64 divisor) {
        Int quotient = IntInit(IntAllocator(result));
    
        bool ok = int_div_mod_i64(&quotient, result, dividend, divisor);
        }
    
        Int quotient = IntInit(IntAllocator(value));
        u64 rem      = int_div_u64_rem(&quotient, value, modulus);
        ValidateInt(b);
    
        Int x = IntInit(IntAllocator(a));
        Int y = IntInit(IntAllocator(b));
    
        Int x = IntInit(IntAllocator(a));
        Int y = IntInit(IntAllocator(b));
    
        if (!int_try_clone_value(&x, a) || !int_try_clone_value(&y, b)) {
    
        while (!IntIsZero(&y)) {
            Int r = IntInit(IntAllocator(result));
    
            if (!int_mod(&r, &x, &y)) {
    
        if (IntIsZero(a) || IntIsZero(b)) {
            Int zero = IntInit(IntAllocator(result));
            int_replace(result, &zero);
            return true;
        }
    
        Int gcd      = IntInit(IntAllocator(result));
        Int quotient = IntInit(IntAllocator(result));
        Int lcm      = IntInit(IntAllocator(result));
    
        Int gcd      = IntInit(IntAllocator(result));
        Int quotient = IntInit(IntAllocator(result));
        Int lcm      = IntInit(IntAllocator(result));
        Int gcd      = IntInit(IntAllocator(result));
        Int quotient = IntInit(IntAllocator(result));
        Int lcm      = IntInit(IntAllocator(result));
    
        if (!IntGCD(&gcd, a, b) || !int_div(&quotient, a, &gcd) || !int_mul(&lcm, &quotient, b)) {
    
        if (IntIsZero(value)) {
            Int zero_root = IntInit(IntAllocator(root));
            Int zero_rem  = IntInit(IntAllocator(remainder));
        if (IntIsZero(value)) {
            Int zero_root = IntInit(IntAllocator(root));
            Int zero_rem  = IntInit(IntAllocator(remainder));
    
            int_replace(root, &zero_root);
        }
        if (degree == 1) {
            Int exact_root = IntInit(IntAllocator(root));
            Int zero_rem   = IntInit(IntAllocator(remainder));
        if (degree == 1) {
            Int exact_root = IntInit(IntAllocator(root));
            Int zero_rem   = IntInit(IntAllocator(remainder));
    
            if (!IntTryClone(&exact_root, value)) {
        u64 bits       = IntBitLength(value);
        u64 high_shift = bits / degree;
        Int low        = IntInit(IntAllocator(root));
        Int high       = IntInit(IntAllocator(root));
        Int best       = IntInit(IntAllocator(root));
        u64 high_shift = bits / degree;
        Int low        = IntInit(IntAllocator(root));
        Int high       = IntInit(IntAllocator(root));
        Int best       = IntInit(IntAllocator(root));
        Int one        = IntInit(IntAllocator(root));
        Int low        = IntInit(IntAllocator(root));
        Int high       = IntInit(IntAllocator(root));
        Int best       = IntInit(IntAllocator(root));
        Int one        = IntInit(IntAllocator(root));
        Int high       = IntInit(IntAllocator(root));
        Int best       = IntInit(IntAllocator(root));
        Int one        = IntInit(IntAllocator(root));
    
        if ((bits % degree) != 0) {
        }
    
        if (!int_try_from_u64(&high, 1, IntAllocator(root)) || !int_try_from_u64(&one, 1, IntAllocator(root))) {
            IntDeinit(&low);
            IntDeinit(&high);
    
        while (IntLE(&low, &high)) {
            Int sum     = IntInit(IntAllocator(root));
            Int mid     = IntInit(IntAllocator(root));
            Int mid_pow = IntInit(IntAllocator(root));
        while (IntLE(&low, &high)) {
            Int sum     = IntInit(IntAllocator(root));
            Int mid     = IntInit(IntAllocator(root));
            Int mid_pow = IntInit(IntAllocator(root));
            int cmp     = 0;
            Int sum     = IntInit(IntAllocator(root));
            Int mid     = IntInit(IntAllocator(root));
            Int mid_pow = IntInit(IntAllocator(root));
            int cmp     = 0;
    
            if (cmp <= 0) {
                Int next = IntInit(IntAllocator(root));
    
                IntDeinit(&best);
                low = next;
            } else {
                Int next = IntInit(IntAllocator(root));
    
                if (IntEQ(&mid, &one) || IntIsZero(&mid)) {
                if (IntEQ(&mid, &one) || IntIsZero(&mid)) {
                    IntDeinit(&high);
                    high = IntInit(IntAllocator(root));
                } else {
                    if (!int_sub(&next, &mid, &one)) {
    
        {
            Int power = IntInit(IntAllocator(root));
            Int rem   = IntInit(IntAllocator(remainder));
        {
            Int power = IntInit(IntAllocator(root));
            Int rem   = IntInit(IntAllocator(remainder));
    
            if (!int_pow_u64(&power, &best, degree) || !int_sub(&rem, value, &power)) {
    
    bool IntRoot(Int *result, const Int *value, u64 degree) {
        Int root      = IntInit(IntAllocator(result));
        Int remainder = IntInit(IntAllocator(result));
    bool IntRoot(Int *result, const Int *value, u64 degree) {
        Int root      = IntInit(IntAllocator(result));
        Int remainder = IntInit(IntAllocator(result));
    
        if (!IntRootRem(&root, &remainder, value, degree)) {
        ValidateInt(value);
    
        Int  root      = IntInit(IntAllocator(value));
        Int  remainder = IntInit(IntAllocator(value));
        bool result    = false;
    
        Int  root      = IntInit(IntAllocator(value));
        Int  remainder = IntInit(IntAllocator(value));
        bool result    = false;
    
        for (u64 degree = 2; degree <= max_degree; degree++) {
            Int  root      = IntInit(IntAllocator(value));
            Int  remainder = IntInit(IntAllocator(value));
            bool exact     = false;
        for (u64 degree = 2; degree <= max_degree; degree++) {
            Int  root      = IntInit(IntAllocator(value));
            Int  remainder = IntInit(IntAllocator(value));
            bool exact     = false;
        }
    
        Int aa     = IntInit(IntAllocator(a));
        Int nn     = IntInit(IntAllocator(n));
        int result = 1;
    
        Int aa     = IntInit(IntAllocator(a));
        Int nn     = IntInit(IntAllocator(n));
        int result = 1;
        }
    
        Int ar  = IntInit(IntAllocator(result));
        Int br  = IntInit(IntAllocator(result));
        Int sum = IntInit(IntAllocator(result));
    
        Int ar  = IntInit(IntAllocator(result));
        Int br  = IntInit(IntAllocator(result));
        Int sum = IntInit(IntAllocator(result));
        Int ar  = IntInit(IntAllocator(result));
        Int br  = IntInit(IntAllocator(result));
        Int sum = IntInit(IntAllocator(result));
    
        if (!int_mod(&ar, a, modulus) || !int_mod(&br, b, modulus) || !int_add(&sum, &ar, &br) ||
        }
    
        Int ar = IntInit(IntAllocator(result));
        Int br = IntInit(IntAllocator(result));
    
        Int ar = IntInit(IntAllocator(result));
        Int br = IntInit(IntAllocator(result));
    
        if (!int_mod(&ar, a, modulus) || !int_mod(&br, b, modulus)) {
            }
        } else {
            Int diff = IntInit(IntAllocator(result));
    
            if (!int_sub(&diff, &br, &ar)) {
            }
            if (IntIsZero(&diff)) {
                Int zero = IntInit(IntAllocator(result));
                int_replace(result, &zero);
            } else {
        }
    
        Int ar   = IntInit(IntAllocator(result));
        Int br   = IntInit(IntAllocator(result));
        Int prod = IntInit(IntAllocator(result));
    
        Int ar   = IntInit(IntAllocator(result));
        Int br   = IntInit(IntAllocator(result));
        Int prod = IntInit(IntAllocator(result));
        Int ar   = IntInit(IntAllocator(result));
        Int br   = IntInit(IntAllocator(result));
        Int prod = IntInit(IntAllocator(result));
    
        if (!int_mod(&ar, a, modulus) || !int_mod(&br, b, modulus) || !int_mul(&prod, &ar, &br) ||
        }
    
        Int  inverse = IntInit(IntAllocator(result));
        Int  value   = IntInit(IntAllocator(result));
        bool ok      = false;
    
        Int  inverse = IntInit(IntAllocator(result));
        Int  value   = IntInit(IntAllocator(result));
        bool ok      = false;
        }
    
        Int acc      = IntInit(IntAllocator(result));
        Int base_mod = IntInit(IntAllocator(result));
    
        Int acc      = IntInit(IntAllocator(result));
        Int base_mod = IntInit(IntAllocator(result));
    
        if (!int_try_from_u64(&acc, 1, IntAllocator(result))) {
        Int base_mod = IntInit(IntAllocator(result));
    
        if (!int_try_from_u64(&acc, 1, IntAllocator(result))) {
            IntDeinit(&base_mod);
            return false;
        while (exponent > 0) {
            if (exponent & 1u) {
                Int next = IntInit(IntAllocator(result));
    
                if (!IntModMul(&next, &acc, &base_mod, modulus)) {
            exponent >>= 1u;
            if (exponent > 0) {
                Int next = IntInit(IntAllocator(result));
    
                if (!IntModMul(&next, &base_mod, &base_mod, modulus)) {
        }
    
        Int acc      = IntInit(IntAllocator(result));
        Int base_mod = IntInit(IntAllocator(result));
        Int exp      = IntInit(IntAllocator(exponent));
    
        Int acc      = IntInit(IntAllocator(result));
        Int base_mod = IntInit(IntAllocator(result));
        Int exp      = IntInit(IntAllocator(exponent));
        Int acc      = IntInit(IntAllocator(result));
        Int base_mod = IntInit(IntAllocator(result));
        Int exp      = IntInit(IntAllocator(exponent));
    
        if (!int_try_from_u64(&acc, 1, IntAllocator(result)) || !IntTryClone(&exp, exponent) ||
        Int exp      = IntInit(IntAllocator(exponent));
    
        if (!int_try_from_u64(&acc, 1, IntAllocator(result)) || !IntTryClone(&exp, exponent) ||
            !int_mod(&acc, &acc, modulus) || !int_mod(&base_mod, base, modulus)) {
            IntDeinit(&acc);
        while (!IntIsZero(&exp)) {
            if (int_is_odd(&exp)) {
                Int next = IntInit(IntAllocator(result));
    
                if (!IntModMul(&next, &acc, &base_mod, modulus)) {
            }
            if (!IntIsZero(&exp)) {
                Int next = IntInit(IntAllocator(result));
    
                if (!IntModMul(&next, &base_mod, &base_mod, modulus)) {
        }
    
        Int       reduced = IntInit(IntAllocator(result));
        SignedInt t       = sint_init(IntAllocator(result));
        SignedInt new_t   = sint_from_u64(1, IntAllocator(result));
    
        Int       reduced = IntInit(IntAllocator(result));
        SignedInt t       = sint_init(IntAllocator(result));
        SignedInt new_t   = sint_from_u64(1, IntAllocator(result));
        Int       r       = IntInit(IntAllocator(modulus));
        Int       reduced = IntInit(IntAllocator(result));
        SignedInt t       = sint_init(IntAllocator(result));
        SignedInt new_t   = sint_from_u64(1, IntAllocator(result));
        Int       r       = IntInit(IntAllocator(modulus));
        Int       new_r   = IntInit(IntAllocator(result));
        SignedInt t       = sint_init(IntAllocator(result));
        SignedInt new_t   = sint_from_u64(1, IntAllocator(result));
        Int       r       = IntInit(IntAllocator(modulus));
        Int       new_r   = IntInit(IntAllocator(result));
        Int       one     = int_from_u64(1, IntAllocator(result));
        SignedInt new_t   = sint_from_u64(1, IntAllocator(result));
        Int       r       = IntInit(IntAllocator(modulus));
        Int       new_r   = IntInit(IntAllocator(result));
        Int       one     = int_from_u64(1, IntAllocator(result));
        bool      ok      = false;
        Int       r       = IntInit(IntAllocator(modulus));
        Int       new_r   = IntInit(IntAllocator(result));
        Int       one     = int_from_u64(1, IntAllocator(result));
        bool      ok      = false;
    
        while (!IntIsZero(&new_r)) {
            Int       q       = IntInit(IntAllocator(result));
            Int       rem     = IntInit(IntAllocator(result));
            SignedInt q_new_t = sint_init(IntAllocator(result));
        while (!IntIsZero(&new_r)) {
            Int       q       = IntInit(IntAllocator(result));
            Int       rem     = IntInit(IntAllocator(result));
            SignedInt q_new_t = sint_init(IntAllocator(result));
            SignedInt next_t  = sint_init(IntAllocator(result));
            Int       q       = IntInit(IntAllocator(result));
            Int       rem     = IntInit(IntAllocator(result));
            SignedInt q_new_t = sint_init(IntAllocator(result));
            SignedInt next_t  = sint_init(IntAllocator(result));
            Int       next_r  = IntInit(IntAllocator(result));
            Int       rem     = IntInit(IntAllocator(result));
            SignedInt q_new_t = sint_init(IntAllocator(result));
            SignedInt next_t  = sint_init(IntAllocator(result));
            Int       next_r  = IntInit(IntAllocator(result));
            SignedInt q_new_t = sint_init(IntAllocator(result));
            SignedInt next_t  = sint_init(IntAllocator(result));
            Int       next_r  = IntInit(IntAllocator(result));
    
            if (!int_div_mod(&q, &rem, &r, &new_r) || !sint_mul_unsigned(&q_new_t, &new_t, &q) ||
    
        if (IntEQ(&r, &one)) {
            Int positive = IntInit(IntAllocator(result));
            Int mag_mod  = IntInit(IntAllocator(result));
        if (IntEQ(&r, &one)) {
            Int positive = IntInit(IntAllocator(result));
            Int mag_mod  = IntInit(IntAllocator(result));
    
            if (!int_mod(&mag_mod, &t.magnitude, modulus)) {
        }
    
        Int  a  = IntInit(IntAllocator(result));
        bool ok = false;
    
        if (IntIsZero(&a)) {
            Int zero = IntInit(IntAllocator(result));
            int_replace(result, &zero);
            IntDeinit(&a);
        }
        if (int_mod_u64(modulus, 4) == 3) {
            Int exponent = IntInit(IntAllocator(modulus));
            Int root     = IntInit(IntAllocator(result));
        if (int_mod_u64(modulus, 4) == 3) {
            Int exponent = IntInit(IntAllocator(modulus));
            Int root     = IntInit(IntAllocator(result));
    
            if (!IntTryClone(&exponent, modulus) || !int_add_u64(&exponent, &exponent, 1) || !IntShiftRight(&exponent, 2) ||
    
        {
            Int q        = IntInit(IntAllocator(modulus));
            Int z        = IntInit(IntAllocator(modulus));
            Int c        = IntInit(IntAllocator(result));
        {
            Int q        = IntInit(IntAllocator(modulus));
            Int z        = IntInit(IntAllocator(modulus));
            Int c        = IntInit(IntAllocator(result));
            Int t        = IntInit(IntAllocator(result));
            Int q        = IntInit(IntAllocator(modulus));
            Int z        = IntInit(IntAllocator(modulus));
            Int c        = IntInit(IntAllocator(result));
            Int t        = IntInit(IntAllocator(result));
            Int r        = IntInit(IntAllocator(result));
            Int z        = IntInit(IntAllocator(modulus));
            Int c        = IntInit(IntAllocator(result));
            Int t        = IntInit(IntAllocator(result));
            Int r        = IntInit(IntAllocator(result));
            Int exponent = IntInit(IntAllocator(result));
            Int c        = IntInit(IntAllocator(result));
            Int t        = IntInit(IntAllocator(result));
            Int r        = IntInit(IntAllocator(result));
            Int exponent = IntInit(IntAllocator(result));
            u64 m        = 0;
            Int t        = IntInit(IntAllocator(result));
            Int r        = IntInit(IntAllocator(result));
            Int exponent = IntInit(IntAllocator(result));
            u64 m        = 0;
            u64 m        = 0;
    
            if (!IntTryClone(&q, modulus) || !int_try_from_u64(&z, 2, IntAllocator(modulus)) || !int_sub_u64(&q, &q, 1)) {
                IntDeinit(&q);
                IntDeinit(&z);
    
            while (int_compare_u64(&t, 1) != 0) {
                Int t_power = IntInit(IntAllocator(&t));
                u64 i       = 0;
    
                for (i = 1; i < m; i++) {
                    Int next = IntInit(IntAllocator(result));
    
                    if (!IntSquareMod(&next, &t_power, modulus)) {
    
                {
                    Int b    = IntInit(IntAllocator(&c));
                    Int b_sq = IntInit(IntAllocator(result));
                    Int next = IntInit(IntAllocator(result));
                {
                    Int b    = IntInit(IntAllocator(&c));
                    Int b_sq = IntInit(IntAllocator(result));
                    Int next = IntInit(IntAllocator(result));
                    Int b    = IntInit(IntAllocator(&c));
                    Int b_sq = IntInit(IntAllocator(result));
                    Int next = IntInit(IntAllocator(result));
    
                    if (!IntTryClone(&b, &c)) {
    
                    for (u64 j = 0; j + i + 1 < m; j++) {
                        Int square = IntInit(IntAllocator(result));
    
                        if (!IntSquareMod(&square, &b, modulus)) {
                        return false;
                    }
                    next = IntInit(IntAllocator(result));
                    if (!IntModMul(&next, &t, &b_sq, modulus)) {
                        IntDeinit(&b);
    
        {
            Int  d           = IntInit(IntAllocator(value));
            Int  n_minus_one = IntInit(IntAllocator(value));
            u64  s           = 0;
        {
            Int  d           = IntInit(IntAllocator(value));
            Int  n_minus_one = IntInit(IntAllocator(value));
            u64  s           = 0;
            bool probable    = true;
    
            for (u64 i = 0; i < (u64)(sizeof(bases) / sizeof(bases[0])); i++) {
                Int base = IntInit(IntAllocator(value));
                Int x    = IntInit(IntAllocator(value));
            for (u64 i = 0; i < (u64)(sizeof(bases) / sizeof(bases[0])); i++) {
                Int base = IntInit(IntAllocator(value));
                Int x    = IntInit(IntAllocator(value));
    
                if (!int_try_from_u64(&base, bases[i], IntAllocator(value))) {
                Int x    = IntInit(IntAllocator(value));
    
                if (!int_try_from_u64(&base, bases[i], IntAllocator(value))) {
                    IntDeinit(&base);
                    IntDeinit(&x);
    
                    for (u64 r = 1; r < s; r++) {
                        Int next = IntInit(IntAllocator(value));
    
                        if (!IntSquareMod(&next, &x, value)) {
    
        if (int_compare_u64(value, 1) <= 0) {
            Int two = IntInit(IntAllocator(result));
    
            if (!int_try_from_u64(&two, 2, IntAllocator(result))) {
            Int two = IntInit(IntAllocator(result));
    
            if (!int_try_from_u64(&two, 2, IntAllocator(result))) {
                IntDeinit(&two);
                return false;
        }
    
        Int candidate = IntInit(IntAllocator(result));
    
        if (!IntTryClone(&candidate, value)) {
        }
        if (int_compare_u64(&candidate, 2) <= 0) {
            Int two = IntInit(IntAllocator(result));
    
            if (!int_try_from_u64(&two, 2, IntAllocator(result))) {
            Int two = IntInit(IntAllocator(result));
    
            if (!int_try_from_u64(&two, 2, IntAllocator(result))) {
                IntDeinit(&two);
                IntDeinit(&candidate);
    
        bool result =
            BitVecLen(&clone.bits) == BitVecLen(&original.bits) && IntAllocator(&clone) == IntAllocator(&original) &&
            IntAllocator(&clone)->allocate == IntAllocator(&original)->allocate &&
            IntAllocator(&clone)->remap == IntAllocator(&original)->remap &&
        bool result =
            BitVecLen(&clone.bits) == BitVecLen(&original.bits) && IntAllocator(&clone) == IntAllocator(&original) &&
            IntAllocator(&clone)->allocate == IntAllocator(&original)->allocate &&
            IntAllocator(&clone)->remap == IntAllocator(&original)->remap &&
            IntAllocator(&clone)->deallocate == IntAllocator(&original)->deallocate &&
            BitVecLen(&clone.bits) == BitVecLen(&original.bits) && IntAllocator(&clone) == IntAllocator(&original) &&
            IntAllocator(&clone)->allocate == IntAllocator(&original)->allocate &&
            IntAllocator(&clone)->remap == IntAllocator(&original)->remap &&
            IntAllocator(&clone)->deallocate == IntAllocator(&original)->deallocate &&
            IntAllocator(&clone)->effort == IntAllocator(&original)->effort &&
            IntAllocator(&clone)->allocate == IntAllocator(&original)->allocate &&
            IntAllocator(&clone)->remap == IntAllocator(&original)->remap &&
            IntAllocator(&clone)->deallocate == IntAllocator(&original)->deallocate &&
            IntAllocator(&clone)->effort == IntAllocator(&original)->effort &&
            IntAllocator(&clone)->retry_limit == IntAllocator(&original)->retry_limit &&
            IntAllocator(&clone)->remap == IntAllocator(&original)->remap &&
            IntAllocator(&clone)->deallocate == IntAllocator(&original)->deallocate &&
            IntAllocator(&clone)->effort == IntAllocator(&original)->effort &&
            IntAllocator(&clone)->retry_limit == IntAllocator(&original)->retry_limit &&
            BitVecGet(&clone.bits, 0) == true && BitVecGet(&clone.bits, 1) == false && BitVecGet(&clone.bits, 2) == true;
            IntAllocator(&clone)->deallocate == IntAllocator(&original)->deallocate &&
            IntAllocator(&clone)->effort == IntAllocator(&original)->effort &&
            IntAllocator(&clone)->retry_limit == IntAllocator(&original)->retry_limit &&
            BitVecGet(&clone.bits, 0) == true && BitVecGet(&clone.bits, 1) == false && BitVecGet(&clone.bits, 2) == true;
    /// TAGS: Float, Access, Allocator
    ///
    #define FloatAllocator(value) IntAllocator(&(value)->significand)
    
    #ifdef __cplusplus
    ///
    #define IntTryToStr(...)                 OVERLOAD(IntTryToStr, __VA_ARGS__)
    #define IntTryToStr_2(out, value)        int_try_to_str((out), (value), IntAllocator((value)))
    #define IntTryToStr_3(out, value, alloc) int_try_to_str((out), (value), (alloc))
    ///
    #define IntToStr(...)            OVERLOAD(IntToStr, __VA_ARGS__)
    #define IntToStr_1(value)        int_to_str((value), IntAllocator((value)))
    #define IntToStr_2(value, alloc) int_to_str((value), (alloc))
    #define IntTryToStrRadix(...) OVERLOAD(IntTryToStrRadix, __VA_ARGS__)
    #define IntTryToStrRadix_4(out, value, radix, uppercase)                                                               \
        int_try_to_str_radix((out), (value), (radix), (uppercase), IntAllocator((value)))
    #define IntTryToStrRadix_5(out, value, radix, uppercase, alloc)                                                        \
        int_try_to_str_radix((out), (value), (radix), (uppercase), (alloc))
    #define IntToStrRadix(...) OVERLOAD(IntToStrRadix, __VA_ARGS__)
    #define IntToStrRadix_3(value, radix, uppercase)                                                                       \
        int_to_str_radix((value), (radix), (uppercase), IntAllocator((value)))
    #define IntToStrRadix_4(value, radix, uppercase, alloc) int_to_str_radix((value), (radix), (uppercase), (alloc))
Last updated on