Skip to content

Int

Int

Description

Arbitrary-precision unsigned integer value. Int stores the magnitude as a little-endian bit-vector with no sign bit.

Fields

Name Description
bits Backing bit storage for the integer magnitude. Treat as internal representation.

Usage example (from documentation)

  Int value = IntFrom(42);

Usage example (Cross-references)

Usage examples (Cross-references)
    }
    
    void _write_Int(Str *o, FmtInfo *fmt_info, Int *value) {
        if (!o || !fmt_info || !value) {
            LOG_FATAL("Invalid arguments");
    
            if (!buffer) {
                LOG_FATAL("Failed to allocate buffer for Int character formatting");
            }
    }
    
    const char *_read_Int(const char *i, FmtInfo *fmt_info, Int *value) {
        if (!i || !value) {
            LOG_FATAL("Invalid arguments");
    
        if (fmt_info && (fmt_info->flags & FMT_FLAG_CHAR)) {
            LOG_ERROR("Character-format reads are not supported for Int");
            return i;
        }
    
        if (!*i) {
            LOG_ERROR("Failed to parse Int: empty input");
            return i;
        }
    
        if (radix == 16 && digits_start[0] == '0' && (digits_start[1] == 'x' || digits_start[1] == 'X')) {
            LOG_ERROR("Int hex reads expect plain hex digits without a 0x prefix");
            return start;
        }
        }
        if (radix == 2 && digits_start[0] == '0' && (digits_start[1] == 'b' || digits_start[1] == 'B')) {
            LOG_ERROR("Int binary reads expect plain binary digits without a 0b prefix");
            return start;
        }
        }
        if (radix == 8 && digits_start[0] == '0' && (digits_start[1] == 'o' || digits_start[1] == 'O')) {
            LOG_ERROR("Int octal reads expect plain octal digits without a 0o prefix");
            return start;
        }
    
        if (i == digits_start) {
            LOG_ERROR("Failed to parse Int");
            return start;
        }
    
        if (*i == '_') {
            LOG_ERROR("Int reads do not accept digit separators");
            return start;
        }
    
        Str temp   = StrInitFromCstr(start, i - start);
        Int parsed = IntFromStrRadix(temp.data, radix);
    
        IntDeinit(value);
    
    #include <Misra/Std/Container/Float.h>
    #include <Misra/Std/Container/Int.h>
    #include <Misra/Std/Log.h>
    static void float_normalize(Float *value);
    static void float_replace(Float *dst, Float *src);
    static Int  float_pow10(u64 power);
    static void float_scale_to_exponent(Float *value, i64 target_exponent);
    static int  float_abs_compare(Float *lhs, Float *rhs);
    }
    
    static Int float_pow10(u64 power) {
        Int base   = MISRA_PRIV_IntFromU64(10);
        Int result = MISRA_PRIV_IntFromU64(1);
    
    static Int float_pow10(u64 power) {
        Int base   = MISRA_PRIV_IntFromU64(10);
        Int result = MISRA_PRIV_IntFromU64(1);
    static Int float_pow10(u64 power) {
        Int base   = MISRA_PRIV_IntFromU64(10);
        Int result = MISRA_PRIV_IntFromU64(1);
    
        MISRA_PRIV_IntPowU64(&result, &base, power);
        {
            u64 places = (u64)(value->exponent - target_exponent);
            Int factor = float_pow10(places);
            Int scaled = IntInit();
            u64 places = (u64)(value->exponent - target_exponent);
            Int factor = float_pow10(places);
            Int scaled = IntInit();
    
            IntMul(&scaled, &value->significand, &factor);
    
        while (MISRA_PRIV_IntModU64(&value->significand, 10) == 0) {
            Int quotient = IntInit();
    
            (void)MISRA_PRIV_IntDivU64Rem(&quotient, &value->significand, 10);
    }
    
    Float MISRA_PRIV_FloatFromInt(Int *value) {
        Float result = FloatInit();
    }
    
    bool FloatToInt(Int *result, Float *value) {
        Int temp = IntInit();
    
    bool FloatToInt(Int *result, Float *value) {
        Int temp = IntInit();
    
        ValidateInt(result);
    
        if (value->exponent >= 0) {
            Int factor = IntInit();
    
            temp = IntClone(&value->significand);
        {
            u64  places = (u64)(-value->exponent);
            Int  factor = float_pow10(places);
            bool ok     = IntDivExact(&temp, &value->significand, &factor);
    }
    
    int MISRA_PRIV_FloatCompareInt(Float *lhs, Int *rhs) {
        Float rhs_value = MISRA_PRIV_FloatFromInt(rhs);
        int   cmp       = FloatCompare(lhs, &rhs_value);
    }
    
    void MISRA_PRIV_FloatAddInt(Float *result, Float *a, Int *b) {
        Float rhs = MISRA_PRIV_FloatFromInt(b);
    }
    
    void MISRA_PRIV_FloatSubInt(Float *result, Float *a, Int *b) {
        Float rhs = MISRA_PRIV_FloatFromInt(b);
    }
    
    void MISRA_PRIV_FloatMulInt(Float *result, Float *a, Int *b) {
        Float rhs = MISRA_PRIV_FloatFromInt(b);
    void(FloatDiv)(Float *result, Float *a, Float *b, u64 precision) {
        Float temp   = FloatInit();
        Int   scale  = IntInit();
        Int   scaled = IntInit();
        Float temp   = FloatInit();
        Int   scale  = IntInit();
        Int   scaled = IntInit();
    
        ValidateFloat(result);
    }
    
    void MISRA_PRIV_FloatDivInt(Float *result, Float *a, Int *b, u64 precision) {
        Float rhs = MISRA_PRIV_FloatFromInt(b);
    /// Arbitrary-precision unsigned integer implementation built on top of BitVec.
    
    #include <Misra/Std/Container/Int.h>
    #include <Misra/Std/Container/BitVec.h>
    #include <Misra/Std/Log.h>
    typedef struct {
        bool negative;
        Int  magnitude;
    } SignedInt;
    #define INT_BITS(value) (&(value)->bits)
    
    static void int_normalize(Int *value);
    static void int_validate_radix(u8 radix);
    static Int  int_from_str_radix_strict(const char *digits, u8 radix);
    static void int_normalize(Int *value);
    static void int_validate_radix(u8 radix);
    static Int  int_from_str_radix_strict(const char *digits, u8 radix);
    
    static Int int_wrap(BitVec bits) {
    static Int  int_from_str_radix_strict(const char *digits, u8 radix);
    
    static Int int_wrap(BitVec bits) {
        Int value;
    
    static Int int_wrap(BitVec bits) {
        Int value;
    
        value.bits = bits;
    }
    
    static Int int_init_with_capacity(u64 capacity) {
        return int_wrap(BitVecInitWithCapacity(capacity));
    }
    }
    
    static u64 int_significant_bits(Int *value) {
        ValidateInt(value);
    }
    
    static void int_replace(Int *dst, Int *src) {
        IntDeinit(dst);
        *dst = *src;
    }
    
    static void int_swap(Int *a, Int *b) {
        Int tmp = *a;
        *a      = *b;
    
    static void int_swap(Int *a, Int *b) {
        Int tmp = *a;
        *a      = *b;
        *b      = tmp;
    }
    
    static void sint_mul_unsigned(SignedInt *result, SignedInt *a, Int *b) {
        SignedInt temp = sint_init();
    }
    
    static void int_normalize(Int *value) {
        ValidateInt(value);
        BitVecResize(INT_BITS(value), int_significant_bits(value));
    }
    
    static bool int_is_odd(Int *value) {
        ValidateInt(value);
        return value->bits.length > 0 && BitVecGet(INT_BITS(value), 0);
    }
    
    static bool int_is_one(Int *value) {
        ValidateInt(value);
        return IntBitLength(value) == 1 && BitVecGet(INT_BITS(value), 0);
    }
    
    static void int_mul_u64_in_place(Int *value, u64 factor) {
        Int lhs    = IntClone(value);
        Int rhs    = MISRA_PRIV_IntFromU64(factor);
    
    static void int_mul_u64_in_place(Int *value, u64 factor) {
        Int lhs    = IntClone(value);
        Int rhs    = MISRA_PRIV_IntFromU64(factor);
        Int result = IntInit();
    static void int_mul_u64_in_place(Int *value, u64 factor) {
        Int lhs    = IntClone(value);
        Int rhs    = MISRA_PRIV_IntFromU64(factor);
        Int result = IntInit();
        Int lhs    = IntClone(value);
        Int rhs    = MISRA_PRIV_IntFromU64(factor);
        Int result = IntInit();
    
        IntMul(&result, &lhs, &rhs);
    }
    
    static void int_add_u64_in_place(Int *value, u64 addend) {
        Int lhs    = IntClone(value);
        Int rhs    = MISRA_PRIV_IntFromU64(addend);
    
    static void int_add_u64_in_place(Int *value, u64 addend) {
        Int lhs    = IntClone(value);
        Int rhs    = MISRA_PRIV_IntFromU64(addend);
        Int result = IntInit();
    static void int_add_u64_in_place(Int *value, u64 addend) {
        Int lhs    = IntClone(value);
        Int rhs    = MISRA_PRIV_IntFromU64(addend);
        Int result = IntInit();
        Int lhs    = IntClone(value);
        Int rhs    = MISRA_PRIV_IntFromU64(addend);
        Int result = IntInit();
    
        IntAdd(&result, &lhs, &rhs);
    }
    
    static Int int_from_str_radix_impl(const char *digits, u64 start, u8 radix) {
        Int  result    = IntInit();
        bool saw_digit = false;
    
    static Int int_from_str_radix_impl(const char *digits, u64 start, u8 radix) {
        Int  result    = IntInit();
        bool saw_digit = false;
            digit = int_radix_digit(digits[i]);
            if (digit < 0 || digit >= radix) {
                LOG_FATAL("Invalid digit for radix in Int conversion");
            }
    }
    
    static Int int_from_str_radix_strict(const char *digits, u8 radix) {
        Int  result    = IntInit();
        bool saw_digit = false;
    
    static Int int_from_str_radix_strict(const char *digits, u8 radix) {
        Int  result    = IntInit();
        bool saw_digit = false;
    
            if (digit < 0 || digit >= radix) {
                LOG_FATAL("Invalid digit for radix in Int conversion");
            }
    }
    
    u64 IntBitLength(Int *value) {
        return int_significant_bits(value);
    }
    }
    
    u64 IntByteLength(Int *value) {
        u64 bits = IntBitLength(value);
        return bits == 0 ? 0 : (bits + 7) / 8;
    }
    
    u64 IntLog2(Int *value) {
        ValidateInt(value);
    }
    
    u64 IntTrailingZeroCount(Int *value) {
        ValidateInt(value);
    }
    
    bool IntIsZero(Int *value) {
        return IntBitLength(value) == 0;
    }
    }
    
    bool IntIsOne(Int *value) {
        return int_is_one(value);
    }
    }
    
    bool IntIsEven(Int *value) {
        ValidateInt(value);
        return !int_is_odd(value);
    }
    
    bool IntIsOdd(Int *value) {
        return int_is_odd(value);
    }
    }
    
    bool IntFitsU64(Int *value) {
        ValidateInt(value);
        return IntBitLength(value) <= 64;
    }
    
    bool IntIsPowerOfTwo(Int *value) {
        ValidateInt(value);
    }
    
    Int IntClone(Int *value) {
        ValidateInt(value);
        ValidateInt(value);
    
        Int clone = int_wrap(BitVecClone(INT_BITS(value)));
        int_normalize(&clone);
        return clone;
    }
    
    Int MISRA_PRIV_IntFromU64(u64 value) {
        u64 bits = int_u64_bits(value);
    }
    
    Int MISRA_PRIV_IntFromI64(i64 value) {
        if (value < 0) {
            LOG_FATAL("Int cannot represent negative values");
    Int MISRA_PRIV_IntFromI64(i64 value) {
        if (value < 0) {
            LOG_FATAL("Int cannot represent negative values");
        }
    }
    
    u64 IntToU64(Int *value) {
        ValidateInt(value);
    
        if (!IntFitsU64(value)) {
            LOG_FATAL("Int value exceeds u64 range");
        }
    }
    
    Int IntFromBytesLE(const u8 *bytes, u64 len) {
        if (!bytes && len != 0) {
            LOG_FATAL("bytes is NULL");
        }
    
        Int result = int_wrap(BitVecFromBytes(bytes, len * 8));
        int_normalize(&result);
        return result;
    }
    
    u64 IntToBytesLE(Int *value, u8 *bytes, u64 max_len) {
        ValidateInt(value);
    }
    
    Int IntFromBytesBE(const u8 *bytes, u64 len) {
        if (!bytes && len != 0) {
            LOG_FATAL("bytes is NULL");
        }
    
        Int result = IntInit();
    
        for (u64 i = 0; i < len; i++) {
    }
    
    u64 IntToBytesBE(Int *value, u8 *bytes, u64 max_len) {
        ValidateInt(value);
    }
    
    Int IntFromStr(const char *decimal) {
        if (!decimal) {
            LOG_FATAL("decimal is NULL");
    }
    
    Str IntToStr(Int *value) {
        return IntToStrRadix(value, 10, false);
    }
    }
    
    Int IntFromStrRadix(const char *digits, u8 radix) {
        u64 start = 0;
    }
    
    Str IntToStrRadix(Int *value, u8 radix, bool uppercase) {
        ValidateInt(value);
        int_validate_radix(radix);
        }
    
        Int current   = IntClone(value);
        Str result    = StrInit();
    
        while (!IntIsZero(&current)) {
            Int quotient = IntInit();
            u64 digit    = 0;
    }
    
    Int IntFromBinary(const char *binary) {
        if (!binary) {
            LOG_FATAL("binary is NULL");
    }
    
    Str IntToBinary(Int *value) {
        return IntToStrRadix(value, 2, false);
    }
    }
    
    Int IntFromOctStr(const char *octal) {
        if (!octal) {
            LOG_FATAL("octal is NULL");
    }
    
    Str IntToOctStr(Int *value) {
        return IntToStrRadix(value, 8, false);
    }
    }
    
    Int IntFromHexStr(const char *hex) {
        if (!hex) {
            LOG_FATAL("hex is NULL");
    }
    
    Str IntToHexStr(Int *value) {
        return IntToStrRadix(value, 16, false);
    }
    }
    
    int(IntCompare)(Int *lhs, Int *rhs) {
        ValidateInt(lhs);
        ValidateInt(rhs);
    }
    
    int MISRA_PRIV_IntCompareU64(Int *lhs, u64 rhs) {
        ValidateInt(lhs);
    }
    
    int MISRA_PRIV_IntCompareI64(Int *lhs, i64 rhs) {
        ValidateInt(lhs);
    }
    
    void IntShiftLeft(Int *value, u64 positions) {
        ValidateInt(value);
    }
    
    void IntShiftRight(Int *value, u64 positions) {
        ValidateInt(value);
    }
    
    void(IntAdd)(Int *result, Int *a, Int *b) {
        ValidateInt(result);
        ValidateInt(a);
        u64 b_bits   = IntBitLength(b);
        u64 max_bits = MAX2(a_bits, b_bits);
        Int temp     = int_init_with_capacity(max_bits + 1);
        bool carry   = false;
    }
    
    void MISRA_PRIV_IntAddU64(Int *result, Int *value, u64 addend) {
        ValidateInt(result);
        ValidateInt(value);
        ValidateInt(value);
    
        Int temp = IntClone(value);
    
        int_add_u64_in_place(&temp, addend);
    }
    
    void MISRA_PRIV_IntAddI64(Int *result, Int *value, i64 addend) {
        u64 magnitude = int_i64_magnitude(addend);
    }
    
    bool(IntSub)(Int *result, Int *a, Int *b) {
        ValidateInt(result);
        ValidateInt(a);
        u64 a_bits = IntBitLength(a);
        u64 b_bits = IntBitLength(b);
        Int temp   = int_init_with_capacity(a_bits);
        bool borrow = false;
    }
    
    bool MISRA_PRIV_IntSubU64(Int *result, Int *value, u64 subtrahend) {
        ValidateInt(result);
        ValidateInt(value);
        ValidateInt(value);
    
        Int rhs = MISRA_PRIV_IntFromU64(subtrahend);
        bool ok = IntSub(result, value, &rhs);
    }
    
    bool MISRA_PRIV_IntSubI64(Int *result, Int *value, i64 subtrahend) {
        u64 magnitude = int_i64_magnitude(subtrahend);
    }
    
    void(IntMul)(Int *result, Int *a, Int *b) {
        ValidateInt(result);
        ValidateInt(a);
    
        u64 b_bits = IntBitLength(b);
        Int acc    = IntInit();
    
        if (IntIsZero(a) || IntIsZero(b)) {
            }
    
            Int partial = IntClone(a);
            Int next    = IntInit();
    
            Int partial = IntClone(a);
            Int next    = IntInit();
    
            int_normalize(&partial);
    }
    
    void MISRA_PRIV_IntMulU64(Int *result, Int *value, u64 factor) {
        ValidateInt(result);
        ValidateInt(value);
        ValidateInt(value);
    
        Int temp = IntClone(value);
    
        int_mul_u64_in_place(&temp, factor);
    }
    
    void MISRA_PRIV_IntMulI64(Int *result, Int *value, i64 factor) {
        if (factor < 0) {
            LOG_FATAL("Int cannot be multiplied by a negative scalar");
    void MISRA_PRIV_IntMulI64(Int *result, Int *value, i64 factor) {
        if (factor < 0) {
            LOG_FATAL("Int cannot be multiplied by a negative scalar");
        }
    }
    
    void IntSquare(Int *result, Int *value) {
        IntMul(result, value, value);
    }
    }
    
    void(IntPow)(Int *result, Int *base, Int *exponent) {
        ValidateInt(result);
        ValidateInt(base);
    
        if (!IntFitsU64(exponent)) {
            LOG_FATAL("Int exponent exceeds u64 range");
        }
    }
    
    void MISRA_PRIV_IntPowU64(Int *result, Int *base, u64 exponent) {
        ValidateInt(result);
        ValidateInt(base);
        ValidateInt(base);
    
        Int acc      = MISRA_PRIV_IntFromU64(1);
        Int current  = IntClone(base);
    
        Int acc      = MISRA_PRIV_IntFromU64(1);
        Int current  = IntClone(base);
    
        while (exponent > 0) {
        while (exponent > 0) {
            if (exponent & 1u) {
                Int next = IntInit();
    
                IntMul(&next, &acc, &current);
            exponent >>= 1u;
            if (exponent > 0) {
                Int next = IntInit();
    
                IntSquare(&next, &current);
    }
    
    void MISRA_PRIV_IntPowI64(Int *result, Int *base, i64 exponent) {
        if (exponent < 0) {
            LOG_FATAL("Int exponent cannot be negative");
    void MISRA_PRIV_IntPowI64(Int *result, Int *base, i64 exponent) {
        if (exponent < 0) {
            LOG_FATAL("Int exponent cannot be negative");
        }
    }
    
    void(IntDivMod)(Int *quotient, Int *remainder, Int *dividend, Int *divisor) {
        ValidateInt(quotient);
        ValidateInt(remainder);
        }
    
        Int normalized_dividend = IntClone(dividend);
        Int normalized_divisor  = IntClone(divisor);
        Int q                   = IntInit();
    
        Int normalized_dividend = IntClone(dividend);
        Int normalized_divisor  = IntClone(divisor);
        Int q                   = IntInit();
        Int r                   = IntClone(&normalized_dividend);
        Int normalized_dividend = IntClone(dividend);
        Int normalized_divisor  = IntClone(divisor);
        Int q                   = IntInit();
        Int r                   = IntClone(&normalized_dividend);
        Int normalized_divisor  = IntClone(divisor);
        Int q                   = IntInit();
        Int r                   = IntClone(&normalized_dividend);
    
        if (IntCompare(&normalized_dividend, &normalized_divisor) >= 0) {
            for (u64 shift = dividend_bits - divisor_bits + 1; shift > 0; shift--) {
                u64 bit = shift - 1;
                Int shifted = IntClone(&normalized_divisor);
    
                IntShiftLeft(&shifted, bit);
    
                if (IntGE(&r, &shifted)) {
                    Int next = IntInit();
    
                    (void)IntSub(&next, &r, &shifted);
    }
    
    void(IntDiv)(Int *result, Int *dividend, Int *divisor) {
        Int quotient  = IntInit();
        Int remainder = IntInit();
    
    void(IntDiv)(Int *result, Int *dividend, Int *divisor) {
        Int quotient  = IntInit();
        Int remainder = IntInit();
    void(IntDiv)(Int *result, Int *dividend, Int *divisor) {
        Int quotient  = IntInit();
        Int remainder = IntInit();
    
        IntDivMod(&quotient, &remainder, dividend, divisor);
    }
    
    bool(IntDivExact)(Int *result, Int *dividend, Int *divisor) {
        ValidateInt(result);
        ValidateInt(dividend);
        }
    
        Int quotient  = IntInit();
        Int remainder = IntInit();
    
        Int quotient  = IntInit();
        Int remainder = IntInit();
    
        IntDivMod(&quotient, &remainder, dividend, divisor);
    }
    
    void MISRA_PRIV_IntDivU64(Int *result, Int *dividend, u64 divisor) {
        Int divisor_value = MISRA_PRIV_IntFromU64(divisor);
    
    void MISRA_PRIV_IntDivU64(Int *result, Int *dividend, u64 divisor) {
        Int divisor_value = MISRA_PRIV_IntFromU64(divisor);
    
        IntDiv(result, dividend, &divisor_value);
    }
    
    void MISRA_PRIV_IntDivI64(Int *result, Int *dividend, i64 divisor) {
        Int divisor_value = MISRA_PRIV_IntFromI64(divisor);
    
    void MISRA_PRIV_IntDivI64(Int *result, Int *dividend, i64 divisor) {
        Int divisor_value = MISRA_PRIV_IntFromI64(divisor);
    
        IntDiv(result, dividend, &divisor_value);
    }
    
    bool MISRA_PRIV_IntDivExactU64(Int *result, Int *dividend, u64 divisor) {
        Int  divisor_value = MISRA_PRIV_IntFromU64(divisor);
        bool ok            = IntDivExact(result, dividend, &divisor_value);
    
    bool MISRA_PRIV_IntDivExactU64(Int *result, Int *dividend, u64 divisor) {
        Int  divisor_value = MISRA_PRIV_IntFromU64(divisor);
        bool ok            = IntDivExact(result, dividend, &divisor_value);
    }
    
    bool MISRA_PRIV_IntDivExactI64(Int *result, Int *dividend, i64 divisor) {
        Int  divisor_value = MISRA_PRIV_IntFromI64(divisor);
        bool ok            = IntDivExact(result, dividend, &divisor_value);
    
    bool MISRA_PRIV_IntDivExactI64(Int *result, Int *dividend, i64 divisor) {
        Int  divisor_value = MISRA_PRIV_IntFromI64(divisor);
        bool ok            = IntDivExact(result, dividend, &divisor_value);
    }
    
    void MISRA_PRIV_IntDivModU64(Int *quotient, Int *remainder, Int *dividend, u64 divisor) {
        Int divisor_value = MISRA_PRIV_IntFromU64(divisor);
    
    void MISRA_PRIV_IntDivModU64(Int *quotient, Int *remainder, Int *dividend, u64 divisor) {
        Int divisor_value = MISRA_PRIV_IntFromU64(divisor);
    
        IntDivMod(quotient, remainder, dividend, &divisor_value);
    }
    
    void MISRA_PRIV_IntDivModI64(Int *quotient, Int *remainder, Int *dividend, i64 divisor) {
        Int divisor_value = MISRA_PRIV_IntFromI64(divisor);
    
    void MISRA_PRIV_IntDivModI64(Int *quotient, Int *remainder, Int *dividend, i64 divisor) {
        Int divisor_value = MISRA_PRIV_IntFromI64(divisor);
    
        IntDivMod(quotient, remainder, dividend, &divisor_value);
    }
    
    u64 MISRA_PRIV_IntDivU64Rem(Int *quotient, Int *dividend, u64 divisor) {
        ValidateInt(quotient);
        ValidateInt(dividend);
        }
    
        Int divisor_value = MISRA_PRIV_IntFromU64(divisor);
        Int remainder     = IntInit();
        u64 rem           = 0;
    
        Int divisor_value = MISRA_PRIV_IntFromU64(divisor);
        Int remainder     = IntInit();
        u64 rem           = 0;
    }
    
    void(IntMod)(Int *result, Int *dividend, Int *divisor) {
        Int quotient  = IntInit();
        Int remainder = IntInit();
    
    void(IntMod)(Int *result, Int *dividend, Int *divisor) {
        Int quotient  = IntInit();
        Int remainder = IntInit();
    void(IntMod)(Int *result, Int *dividend, Int *divisor) {
        Int quotient  = IntInit();
        Int remainder = IntInit();
    
        IntDivMod(&quotient, &remainder, dividend, divisor);
    }
    
    void MISRA_PRIV_IntModU64Into(Int *result, Int *dividend, u64 divisor) {
        Int quotient = IntInit();
    
    void MISRA_PRIV_IntModU64Into(Int *result, Int *dividend, u64 divisor) {
        Int quotient = IntInit();
    
        MISRA_PRIV_IntDivModU64(&quotient, result, dividend, divisor);
    }
    
    void MISRA_PRIV_IntModI64Into(Int *result, Int *dividend, i64 divisor) {
        Int quotient = IntInit();
    
    void MISRA_PRIV_IntModI64Into(Int *result, Int *dividend, i64 divisor) {
        Int quotient = IntInit();
    
        MISRA_PRIV_IntDivModI64(&quotient, result, dividend, divisor);
    }
    
    u64 MISRA_PRIV_IntModU64(Int *value, u64 modulus) {
        ValidateInt(value);
        }
    
        Int quotient = IntInit();
        u64 rem      = MISRA_PRIV_IntDivU64Rem(&quotient, value, modulus);
    }
    
    void IntGCD(Int *result, Int *a, Int *b) {
        ValidateInt(result);
        ValidateInt(a);
        ValidateInt(b);
    
        Int x = IntClone(a);
        Int y = IntClone(b);
    
        Int x = IntClone(a);
        Int y = IntClone(b);
    
        while (!IntIsZero(&y)) {
    
        while (!IntIsZero(&y)) {
            Int r = IntInit();
    
            IntMod(&r, &x, &y);
    }
    
    void IntLCM(Int *result, Int *a, Int *b) {
        ValidateInt(result);
        ValidateInt(a);
    
        if (IntIsZero(a) || IntIsZero(b)) {
            Int zero = IntInit();
            int_replace(result, &zero);
            return;
        }
    
        Int gcd      = IntInit();
        Int quotient = IntInit();
        Int lcm      = IntInit();
    
        Int gcd      = IntInit();
        Int quotient = IntInit();
        Int lcm      = IntInit();
        Int gcd      = IntInit();
        Int quotient = IntInit();
        Int lcm      = IntInit();
    
        IntGCD(&gcd, a, b);
    }
    
    void IntRootRem(Int *root, Int *remainder, Int *value, u64 degree) {
        ValidateInt(root);
        ValidateInt(remainder);
    
        if (IntIsZero(value)) {
            Int zero_root = IntInit();
            Int zero_rem  = IntInit();
        if (IntIsZero(value)) {
            Int zero_root = IntInit();
            Int zero_rem  = IntInit();
    
            int_replace(root, &zero_root);
        }
        if (degree == 1) {
            Int exact_root = IntClone(value);
            Int zero_rem   = IntInit();
        if (degree == 1) {
            Int exact_root = IntClone(value);
            Int zero_rem   = IntInit();
    
            int_replace(root, &exact_root);
        u64 bits       = IntBitLength(value);
        u64 high_shift = bits / degree;
        Int low        = IntInit();
        Int high       = MISRA_PRIV_IntFromU64(1);
        Int best       = IntInit();
        u64 high_shift = bits / degree;
        Int low        = IntInit();
        Int high       = MISRA_PRIV_IntFromU64(1);
        Int best       = IntInit();
        Int one        = MISRA_PRIV_IntFromU64(1);
        Int low        = IntInit();
        Int high       = MISRA_PRIV_IntFromU64(1);
        Int best       = IntInit();
        Int one        = MISRA_PRIV_IntFromU64(1);
        Int high       = MISRA_PRIV_IntFromU64(1);
        Int best       = IntInit();
        Int one        = MISRA_PRIV_IntFromU64(1);
    
        if ((bits % degree) != 0) {
    
        while (IntLE(&low, &high)) {
            Int sum     = IntInit();
            Int mid     = IntInit();
            Int mid_pow = IntInit();
        while (IntLE(&low, &high)) {
            Int sum     = IntInit();
            Int mid     = IntInit();
            Int mid_pow = IntInit();
            int cmp     = 0;
            Int sum     = IntInit();
            Int mid     = IntInit();
            Int mid_pow = IntInit();
            int cmp     = 0;
    
            if (cmp <= 0) {
                Int next = IntInit();
    
                IntDeinit(&best);
                low = next;
            } else {
                Int next = IntInit();
    
                if (IntEQ(&mid, &one) || IntIsZero(&mid)) {
    
        {
            Int power = IntInit();
            Int rem   = IntInit();
        {
            Int power = IntInit();
            Int rem   = IntInit();
    
            MISRA_PRIV_IntPowU64(&power, &best, degree);
    }
    
    void IntRoot(Int *result, Int *value, u64 degree) {
        Int root      = IntInit();
        Int remainder = IntInit();
    
    void IntRoot(Int *result, Int *value, u64 degree) {
        Int root      = IntInit();
        Int remainder = IntInit();
    void IntRoot(Int *result, Int *value, u64 degree) {
        Int root      = IntInit();
        Int remainder = IntInit();
    
        IntRootRem(&root, &remainder, value, degree);
    }
    
    void IntSqrtRem(Int *root, Int *remainder, Int *value) {
        IntRootRem(root, remainder, value, 2);
    }
    }
    
    void IntSqrt(Int *result, Int *value) {
        IntRoot(result, value, 2);
    }
    }
    
    bool IntIsPerfectSquare(Int *value) {
        ValidateInt(value);
        ValidateInt(value);
    
        Int root      = IntInit();
        Int remainder = IntInit();
        bool result   = false;
    
        Int root      = IntInit();
        Int remainder = IntInit();
        bool result   = false;
    }
    
    bool IntIsPerfectPower(Int *value) {
        ValidateInt(value);
    
        for (u64 degree = 2; degree <= max_degree; degree++) {
            Int root      = IntInit();
            Int remainder = IntInit();
            bool exact    = false;
        for (u64 degree = 2; degree <= max_degree; degree++) {
            Int root      = IntInit();
            Int remainder = IntInit();
            bool exact    = false;
    }
    
    int IntJacobi(Int *a, Int *n) {
        ValidateInt(a);
        ValidateInt(n);
        }
    
        Int aa = IntInit();
        Int nn = IntClone(n);
        int result = 1;
    
        Int aa = IntInit();
        Int nn = IntClone(n);
        int result = 1;
    }
    
    void IntModAdd(Int *result, Int *a, Int *b, Int *modulus) {
        ValidateInt(result);
        ValidateInt(a);
        }
    
        Int ar  = IntInit();
        Int br  = IntInit();
        Int sum = IntInit();
    
        Int ar  = IntInit();
        Int br  = IntInit();
        Int sum = IntInit();
        Int ar  = IntInit();
        Int br  = IntInit();
        Int sum = IntInit();
    
        IntMod(&ar, a, modulus);
    }
    
    void IntModSub(Int *result, Int *a, Int *b, Int *modulus) {
        ValidateInt(result);
        ValidateInt(a);
        }
    
        Int ar = IntInit();
        Int br = IntInit();
    
        Int ar = IntInit();
        Int br = IntInit();
    
        IntMod(&ar, a, modulus);
            (void)IntSub(result, &ar, &br);
        } else {
            Int diff = IntInit();
    
            (void)IntSub(&diff, &br, &ar);
            (void)IntSub(&diff, &br, &ar);
            if (IntIsZero(&diff)) {
                Int zero = IntInit();
                int_replace(result, &zero);
            } else {
    }
    
    void IntModMul(Int *result, Int *a, Int *b, Int *modulus) {
        ValidateInt(result);
        ValidateInt(a);
        }
    
        Int ar   = IntInit();
        Int br   = IntInit();
        Int prod = IntInit();
    
        Int ar   = IntInit();
        Int br   = IntInit();
        Int prod = IntInit();
        Int ar   = IntInit();
        Int br   = IntInit();
        Int prod = IntInit();
    
        IntMod(&ar, a, modulus);
    }
    
    bool IntModDiv(Int *result, Int *a, Int *b, Int *modulus) {
        ValidateInt(result);
        ValidateInt(a);
        }
    
        Int inverse = IntInit();
        Int value   = IntInit();
        bool ok     = false;
    
        Int inverse = IntInit();
        Int value   = IntInit();
        bool ok     = false;
    }
    
    void IntSquareMod(Int *result, Int *value, Int *modulus) {
        IntModMul(result, value, value, modulus);
    }
    }
    
    void MISRA_PRIV_IntPowU64Mod(Int *result, Int *base, u64 exponent, Int *modulus) {
        ValidateInt(result);
        ValidateInt(base);
        }
    
        Int acc      = MISRA_PRIV_IntFromU64(1);
        Int base_mod = IntInit();
    
        Int acc      = MISRA_PRIV_IntFromU64(1);
        Int base_mod = IntInit();
    
        IntMod(&acc, &acc, modulus);
        while (exponent > 0) {
            if (exponent & 1u) {
                Int next = IntInit();
    
                IntModMul(&next, &acc, &base_mod, modulus);
            exponent >>= 1u;
            if (exponent > 0) {
                Int next = IntInit();
    
                IntModMul(&next, &base_mod, &base_mod, modulus);
    }
    
    void(IntPowMod)(Int *result, Int *base, Int *exponent, Int *modulus) {
        ValidateInt(result);
        ValidateInt(base);
        }
    
        Int acc      = MISRA_PRIV_IntFromU64(1);
        Int base_mod = IntInit();
        Int exp      = IntClone(exponent);
    
        Int acc      = MISRA_PRIV_IntFromU64(1);
        Int base_mod = IntInit();
        Int exp      = IntClone(exponent);
        Int acc      = MISRA_PRIV_IntFromU64(1);
        Int base_mod = IntInit();
        Int exp      = IntClone(exponent);
    
        IntMod(&acc, &acc, modulus);
        while (!IntIsZero(&exp)) {
            if (int_is_odd(&exp)) {
                Int next = IntInit();
    
                IntModMul(&next, &acc, &base_mod, modulus);
            IntShiftRight(&exp, 1);
            if (!IntIsZero(&exp)) {
                Int next = IntInit();
    
                IntModMul(&next, &base_mod, &base_mod, modulus);
    }
    
    void MISRA_PRIV_IntPowI64Mod(Int *result, Int *base, i64 exponent, Int *modulus) {
        if (exponent < 0) {
            LOG_FATAL("Int exponent cannot be negative");
    void MISRA_PRIV_IntPowI64Mod(Int *result, Int *base, i64 exponent, Int *modulus) {
        if (exponent < 0) {
            LOG_FATAL("Int exponent cannot be negative");
        }
    }
    
    bool IntModInv(Int *result, Int *value, Int *modulus) {
        ValidateInt(result);
        ValidateInt(value);
        }
    
        Int       reduced = IntInit();
        SignedInt t       = sint_init();
        SignedInt new_t   = sint_from_u64(1);
        SignedInt t       = sint_init();
        SignedInt new_t   = sint_from_u64(1);
        Int       r       = IntClone(modulus);
        Int       new_r   = IntInit();
        Int       one     = MISRA_PRIV_IntFromU64(1);
        SignedInt new_t   = sint_from_u64(1);
        Int       r       = IntClone(modulus);
        Int       new_r   = IntInit();
        Int       one     = MISRA_PRIV_IntFromU64(1);
        bool      ok      = false;
        Int       r       = IntClone(modulus);
        Int       new_r   = IntInit();
        Int       one     = MISRA_PRIV_IntFromU64(1);
        bool      ok      = false;
    
        while (!IntIsZero(&new_r)) {
            Int       q        = IntInit();
            Int       rem      = IntInit();
            SignedInt q_new_t  = sint_init();
        while (!IntIsZero(&new_r)) {
            Int       q        = IntInit();
            Int       rem      = IntInit();
            SignedInt q_new_t  = sint_init();
            SignedInt next_t   = sint_init();
            SignedInt q_new_t  = sint_init();
            SignedInt next_t   = sint_init();
            Int       next_r   = IntInit();
    
            IntDivMod(&q, &rem, &r, &new_r);
    
        if (IntEQ(&r, &one)) {
            Int positive = IntInit();
            Int mag_mod   = IntInit();
        if (IntEQ(&r, &one)) {
            Int positive = IntInit();
            Int mag_mod   = IntInit();
    
            IntMod(&mag_mod, &t.magnitude, modulus);
    }
    
    bool IntModSqrt(Int *result, Int *value, Int *modulus) {
        ValidateInt(result);
        ValidateInt(value);
        }
    
        Int a = IntInit();
        bool ok = false;
    
        if (IntIsZero(&a)) {
            Int zero = IntInit();
            int_replace(result, &zero);
            IntDeinit(&a);
        }
        if (MISRA_PRIV_IntModU64(modulus, 4) == 3) {
            Int exponent = IntClone(modulus);
            Int root     = IntInit();
        if (MISRA_PRIV_IntModU64(modulus, 4) == 3) {
            Int exponent = IntClone(modulus);
            Int root     = IntInit();
    
            MISRA_PRIV_IntAddU64(&exponent, &exponent, 1);
    
        {
            Int q       = IntClone(modulus);
            Int z       = MISRA_PRIV_IntFromU64(2);
            Int c       = IntInit();
        {
            Int q       = IntClone(modulus);
            Int z       = MISRA_PRIV_IntFromU64(2);
            Int c       = IntInit();
            Int t       = IntInit();
            Int q       = IntClone(modulus);
            Int z       = MISRA_PRIV_IntFromU64(2);
            Int c       = IntInit();
            Int t       = IntInit();
            Int r       = IntInit();
            Int z       = MISRA_PRIV_IntFromU64(2);
            Int c       = IntInit();
            Int t       = IntInit();
            Int r       = IntInit();
            Int exponent = IntInit();
            Int c       = IntInit();
            Int t       = IntInit();
            Int r       = IntInit();
            Int exponent = IntInit();
            u64 m       = 0;
            Int t       = IntInit();
            Int r       = IntInit();
            Int exponent = IntInit();
            u64 m       = 0;
    
            while (MISRA_PRIV_IntCompareU64(&t, 1) != 0) {
                Int t_power = IntClone(&t);
                u64 i       = 0;
    
                for (i = 1; i < m; i++) {
                    Int next = IntInit();
    
                    IntSquareMod(&next, &t_power, modulus);
    
                {
                    Int b    = IntClone(&c);
                    Int b_sq = IntInit();
                    Int next = IntInit();
                {
                    Int b    = IntClone(&c);
                    Int b_sq = IntInit();
                    Int next = IntInit();
                    Int b    = IntClone(&c);
                    Int b_sq = IntInit();
                    Int next = IntInit();
    
                    for (u64 j = 0; j + i + 1 < m; j++) {
    
                    for (u64 j = 0; j + i + 1 < m; j++) {
                        Int square = IntInit();
    
                        IntSquareMod(&square, &b, modulus);
    }
    
    bool IntIsProbablePrime(Int *value) {
        static const u64 bases[] = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37};
    
        {
            Int d           = IntClone(value);
            Int n_minus_one = IntInit();
            u64 s           = 0;
        {
            Int d           = IntClone(value);
            Int n_minus_one = IntInit();
            u64 s           = 0;
            bool probable   = true;
    
            for (u64 i = 0; i < (u64)(sizeof(bases) / sizeof(bases[0])); i++) {
                Int base = MISRA_PRIV_IntFromU64(bases[i]);
                Int x    = IntInit();
            for (u64 i = 0; i < (u64)(sizeof(bases) / sizeof(bases[0])); i++) {
                Int base = MISRA_PRIV_IntFromU64(bases[i]);
                Int x    = IntInit();
    
                if (IntCompare(&base, value) >= 0) {
    
                    for (u64 r = 1; r < s; r++) {
                        Int next = IntInit();
    
                        IntSquareMod(&next, &x, value);
    }
    
    void IntNextPrime(Int *result, Int *value) {
        ValidateInt(result);
        ValidateInt(value);
    
        if (MISRA_PRIV_IntCompareU64(value, 1) <= 0) {
            Int two = MISRA_PRIV_IntFromU64(2);
            int_replace(result, &two);
            return;
        }
    
        Int candidate = IntClone(value);
    
        MISRA_PRIV_IntAddU64(&candidate, &candidate, 1);
        MISRA_PRIV_IntAddU64(&candidate, &candidate, 1);
        if (MISRA_PRIV_IntCompareU64(&candidate, 2) <= 0) {
            Int two = MISRA_PRIV_IntFromU64(2);
            IntDeinit(&candidate);
            int_replace(result, &two);
    #include <Misra/Std/Container/Float.h>
    #include <Misra/Std/Container/Int.h>
    #include <Misra/Std/Log.h>
    #include <string.h>
        Float a            = FloatFromStr("1.25");
        Float b            = FloatFromStr("0.75");
        Int   whole        = IntFrom(2);
        Float result_value = FloatInit();
        Str   text         = StrInit();
        Float a            = FloatFromStr("5.5");
        Float b            = FloatFromStr("0.5");
        Int   whole        = IntFrom(2);
        Float result_value = FloatInit();
        Str   text         = StrInit();
        Float a            = FloatFromStr("1.5");
        Float b            = FloatFromStr("2");
        Int   whole        = IntFrom(2);
        Float result_value = FloatInit();
        Str   text         = StrInit();
        Float a            = FloatFromStr("7.5");
        Float b            = FloatFromStr("2.5");
        Int   whole        = IntFrom(3);
        Float result_value = FloatInit();
        Str   text         = StrInit();
    #include <Misra/Std/Container/Int.h>
    #include <Misra/Std/Log.h>
    #include <Misra/Types.h>
        WriteFmt("Testing IntFrom with unsigned integer\n");
    
        Int value = IntFrom(13);
        Str text  = IntToBinary(&value);
    
    bool test_int_bytes_le_round_trip(void) {
        WriteFmt("Testing Int little-endian byte conversion\n");
    
        u8  bytes[] = {0x34, 0x12, 0xEF, 0xCD};
        u8  bytes[] = {0x34, 0x12, 0xEF, 0xCD};
        u8  out[4]  = {0};
        Int value   = IntFromBytesLE(bytes, sizeof(bytes));
        u64 written = IntToBytesLE(&value, out, sizeof(out));
        Str text    = IntToHexStr(&value);
    
    bool test_int_bytes_be_round_trip(void) {
        WriteFmt("Testing Int big-endian byte conversion\n");
    
        u8  bytes[] = {0x12, 0x34, 0x56, 0x78};
        u8  bytes[] = {0x12, 0x34, 0x56, 0x78};
        u8  out[4]  = {0};
        Int value   = IntFromBytesBE(bytes, sizeof(bytes));
        u64 written = IntToBytesBE(&value, out, sizeof(out));
        Str text    = IntToHexStr(&value);
    
    bool test_int_binary_round_trip(void) {
        WriteFmt("Testing Int binary round trip\n");
    
        Int value = IntFromBinary("001011");
        WriteFmt("Testing Int binary round trip\n");
    
        Int value = IntFromBinary("001011");
        Str text  = IntToBinary(&value);
    
    bool test_int_decimal_round_trip(void) {
        WriteFmt("Testing Int decimal round trip\n");
    
        const char *digits = "123456789012345678901234567890";
    
        const char *digits = "123456789012345678901234567890";
        Int         value  = IntFromStr(digits);
        Str         text   = IntToStr(&value);
    
    bool test_int_radix_round_trip(void) {
        WriteFmt("Testing Int radix conversion round trip\n");
    
        Int value = IntFromStrRadix("zz", 36);
        WriteFmt("Testing Int radix conversion round trip\n");
    
        Int value = IntFromStrRadix("zz", 36);
        Str text  = IntToStrRadix(&value, 36, false);
    
    bool test_int_upper_hex_radix(void) {
        WriteFmt("Testing Int uppercase radix conversion\n");
    
        Int value = IntFrom(0xBEEF);
        WriteFmt("Testing Int uppercase radix conversion\n");
    
        Int value = IntFrom(0xBEEF);
        Str text  = IntToStrRadix(&value, 16, true);
        WriteFmt("Testing IntCompare leading-zero normalization\n");
    
        Int lhs = IntFromBinary("0001011");
        Int rhs = IntFrom(11);
    
        Int lhs = IntFromBinary("0001011");
        Int rhs = IntFrom(11);
    
        bool result = IntCompare(&lhs, &rhs) == 0;
    
    bool test_int_zero_binary(void) {
        WriteFmt("Testing Int zero binary conversion\n");
    
        Int zero = IntFromBinary("0");
        WriteFmt("Testing Int zero binary conversion\n");
    
        Int zero = IntFromBinary("0");
        Str text = IntToBinary(&zero);
    
    bool test_int_binary_prefix_and_separators(void) {
        WriteFmt("Testing Int binary prefix and separators\n");
    
        Int value = IntFromBinary("0b1010_0011");
        WriteFmt("Testing Int binary prefix and separators\n");
    
        Int value = IntFromBinary("0b1010_0011");
    
        bool result = IntToU64(&value) == 163;
    
    bool test_int_octal_round_trip(void) {
        WriteFmt("Testing Int octal round trip\n");
    
        Int value = IntFromOctStr("0o7_55");
        WriteFmt("Testing Int octal round trip\n");
    
        Int value = IntFromOctStr("0o7_55");
        Str text  = IntToOctStr(&value);
    
    bool test_int_hex_round_trip(void) {
        WriteFmt("Testing Int hex round trip\n");
    
        const char *hex   = "deadbeefcafebabe1234";
    
        const char *hex   = "deadbeefcafebabe1234";
        Int         value = IntFromHexStr(hex);
        Str         text  = IntToHexStr(&value);
        WriteFmt("Testing IntToU64 overflow handling\n");
    
        Int value = IntFrom(1);
        IntShiftLeft(&value, 64);
        IntToU64(&value);
        WriteFmt("Testing IntToStrRadix invalid radix handling\n");
    
        Int value = IntFrom(255);
    
        IntToStrRadix(&value, 37, false);
        WriteFmt("Testing IntToBytesLE NULL handling\n");
    
        Int value = IntFrom(1);
        IntToBytesLE(&value, NULL, 1);
        return false;
        WriteFmt("Testing IntToBytesBE zero max_len handling\n");
    
        Int value = IntFrom(1);
        u8  byte  = 0;
    
    int main(void) {
        WriteFmt("[INFO] Starting Int.Convert tests\n\n");
    
        TestFunction tests[] = {
        int total_deadend_tests = sizeof(deadend_tests) / sizeof(deadend_tests[0]);
    
        return run_test_suite(tests, total_tests, deadend_tests, total_deadend_tests, "Int.Convert");
    }
    #include <Misra/Std/Container/Int.h>
    #include <Misra/Std/Log.h>
    #include <Misra/Types.h>
        WriteFmt("Testing IntCompare\n");
    
        Int a = IntFrom(41);
        Int b = IntFrom(42);
        Int c = IntFromBinary("000101010");
    
        Int a = IntFrom(41);
        Int b = IntFrom(42);
        Int c = IntFromBinary("000101010");
        Int a = IntFrom(41);
        Int b = IntFrom(42);
        Int c = IntFromBinary("000101010");
    
        bool result = IntCompare(&a, &b) < 0;
    
    bool test_int_compare_wrappers(void) {
        WriteFmt("Testing Int compare wrappers\n");
    
        Int a = IntFrom(41);
        WriteFmt("Testing Int compare wrappers\n");
    
        Int a = IntFrom(41);
        Int b = IntFrom(42);
        Int c = IntFromBinary("000101010");
    
        Int a = IntFrom(41);
        Int b = IntFrom(42);
        Int c = IntFromBinary("000101010");
        Int a = IntFrom(41);
        Int b = IntFrom(42);
        Int c = IntFromBinary("000101010");
    
        bool result = IntLT(&a, &b);
        WriteFmt("Testing IntCompare generic dispatch\n");
    
        Int value = IntFrom(42);
        Int same  = IntFromBinary("00101010");
        Int big   = IntFrom(1);
    
        Int value = IntFrom(42);
        Int same  = IntFromBinary("00101010");
        Int big   = IntFrom(1);
        Int value = IntFrom(42);
        Int same  = IntFromBinary("00101010");
        Int big   = IntFrom(1);
    
        IntShiftLeft(&big, 80);
    
    int main(void) {
        WriteFmt("[INFO] Starting Int.Compare tests\n\n");
    
        TestFunction tests[] = {
    
        int total_tests = sizeof(tests) / sizeof(tests[0]);
        return run_test_suite(tests, total_tests, NULL, 0, "Int.Compare");
    }
    
    bool test_int_reading(void) {
        WriteFmt("Testing Int reading\n");
    
        const char *z = NULL;
        bool        success = true;
    
        Int dec = IntInit();
        Int hex = IntInit();
        Int bin = IntInit();
    
        Int dec = IntInit();
        Int hex = IntInit();
        Int bin = IntInit();
        Int oct = IntInit();
        Int dec = IntInit();
        Int hex = IntInit();
        Int bin = IntInit();
        Int oct = IntInit();
        Int hex = IntInit();
        Int bin = IntInit();
        Int oct = IntInit();
    
        Str dec_text = StrInit();
    #include <Misra/Std/Container/Float.h>
    #include <Misra/Std/Container/Int.h>
    #include <Misra/Std/Log.h>
        Float value = FloatFromStr("12.5");
        Float same  = FloatFromStr("12.5");
        Int   whole = IntFrom(12);
        Int   next  = IntFrom(13);
        Float same  = FloatFromStr("12.5");
        Int   whole = IntFrom(12);
        Int   next  = IntFrom(13);
    
        bool result = (FloatCompare(&value, same) == 0);
    
    bool test_int_formatting(void) {
        WriteFmt("Testing Int formatting\n");
    
        Str  output  = StrInit();
        bool success = true;
    
        Int big_dec = IntFromStr("123456789012345678901234567890");
        Int hex_val = IntFromHexStr("deadbeefcafebabe1234");
        Int bin_val = IntFromBinary("10100011");
    
        Int big_dec = IntFromStr("123456789012345678901234567890");
        Int hex_val = IntFromHexStr("deadbeefcafebabe1234");
        Int bin_val = IntFromBinary("10100011");
        Int oct_val = IntFrom(493);
        Int big_dec = IntFromStr("123456789012345678901234567890");
        Int hex_val = IntFromHexStr("deadbeefcafebabe1234");
        Int bin_val = IntFromBinary("10100011");
        Int oct_val = IntFrom(493);
        Int hex_val = IntFromHexStr("deadbeefcafebabe1234");
        Int bin_val = IntFromBinary("10100011");
        Int oct_val = IntFrom(493);
    
        StrWriteFmt(&output, "{}", big_dec);
    #include <Misra/Std/Container/Int.h>
    #include <Misra/Std/Log.h>
    #include <Misra/Types.h>
        WriteFmt("Testing IntBitLength\n");
    
        Int value = IntFromBinary("00101000");
    
        bool result = IntBitLength(&value) == 6;
        WriteFmt("Testing IntByteLength\n");
    
        Int value = IntFromBinary("0001001000110100");
    
        bool result = IntByteLength(&value) == 2;
        WriteFmt("Testing IntIsZero\n");
    
        Int zero     = IntInit();
        Int non_zero = IntFrom(1);
    
        Int zero     = IntInit();
        Int non_zero = IntFrom(1);
    
        bool result = IntIsZero(&zero);
        WriteFmt("Testing IntIsOne\n");
    
        Int one = IntFrom(1);
        Int two = IntFrom(2);
    
        Int one = IntFrom(1);
        Int two = IntFrom(2);
    
        bool result = IntIsOne(&one);
    
    bool test_int_parity(void) {
        WriteFmt("Testing Int parity helpers\n");
    
        Int even = IntFrom(42);
        WriteFmt("Testing Int parity helpers\n");
    
        Int even = IntFrom(42);
        Int odd  = IntFrom(43);
    
        Int even = IntFrom(42);
        Int odd  = IntFrom(43);
    
        bool result = IntIsEven(&even);
        WriteFmt("Testing IntFitsU64\n");
    
        Int small = IntFrom(UINT64_MAX);
        Int big   = IntFrom(1);
    
        Int small = IntFrom(UINT64_MAX);
        Int big   = IntFrom(1);
    
        IntShiftLeft(&big, 64);
        WriteFmt("Testing IntLog2\n");
    
        Int value = IntFrom(1025);
    
        bool result = IntLog2(&value) == 10;
        WriteFmt("Testing IntTrailingZeroCount\n");
    
        Int value = IntFromBinary("1010000");
        Int zero  = IntInit();
    
        Int value = IntFromBinary("1010000");
        Int zero  = IntInit();
    
        bool result = IntTrailingZeroCount(&value) == 4;
        WriteFmt("Testing IntIsPowerOfTwo\n");
    
        Int one   = IntFrom(1);
        Int power = IntFrom(1);
        Int other = IntFrom(24);
    
        Int one   = IntFrom(1);
        Int power = IntFrom(1);
        Int other = IntFrom(24);
        Int zero  = IntInit();
        Int one   = IntFrom(1);
        Int power = IntFrom(1);
        Int other = IntFrom(24);
        Int zero  = IntInit();
        Int power = IntFrom(1);
        Int other = IntFrom(24);
        Int zero  = IntInit();
    
        IntShiftLeft(&power, 20);
        WriteFmt("Testing IntLog2 zero handling\n");
    
        Int value = IntInit();
    
        IntLog2(&value);
    
    int main(void) {
        WriteFmt("[INFO] Starting Int.Access tests\n\n");
    
        TestFunction tests[] = {
        int total_deadend_tests = sizeof(deadend_tests) / sizeof(deadend_tests[0]);
    
        return run_test_suite(tests, total_tests, deadend_tests, total_deadend_tests, "Int.Access");
    }
    #include <Misra/Std/Container/Float.h>
    #include <Misra/Std/Container/Int.h>
    #include <Misra/Std/Log.h>
    #include <string.h>
    
    bool test_float_from_int_container(void) {
        WriteFmt("Testing FloatFrom with Int container\n");
    
        Int   integer = IntFromStr("12345678901234567890");
        WriteFmt("Testing FloatFrom with Int container\n");
    
        Int   integer = IntFromStr("12345678901234567890");
        Float value   = FloatFrom(&integer);
        Str   text    = FloatToStr(&value);
    
        Float value        = FloatFromStr("1234500e-2");
        Int   result_value = IntInit();
        Str   text         = StrInit();
    
        Float value        = FloatFromStr("123.45");
        Int   result_value = IntFrom(99);
    
        bool result = !FloatToInt(&result_value, &value);
    
        Float value        = FloatFromStr("-42");
        Int   result_value = IntFrom(99);
    
        bool result = !FloatToInt(&result_value, &value);
    #include <Misra/Std/Container/Int.h>
    #include <Misra/Std/Log.h>
    #include <Misra/Types.h>
        WriteFmt("Testing IntShiftLeft\n");
    
        Int value = IntFrom(3);
    
        IntShiftLeft(&value, 4);
        WriteFmt("Testing IntShiftRight\n");
    
        Int value = IntFromBinary("110000");
    
        IntShiftRight(&value, 4);
        WriteFmt("Testing IntAdd\n");
    
        Int a      = IntFrom(255);
        Int b      = IntFrom(1);
        Int result_value = IntInit();
    
        Int a      = IntFrom(255);
        Int b      = IntFrom(1);
        Int result_value = IntInit();
        Str text   = StrInit();
        Int a      = IntFrom(255);
        Int b      = IntFrom(1);
        Int result_value = IntInit();
        Str text   = StrInit();
        WriteFmt("Testing IntAdd generic dispatch\n");
    
        Int base         = IntFrom(40);
        Int rhs          = IntFrom(2);
        Int result_value = IntInit();
    
        Int base         = IntFrom(40);
        Int rhs          = IntFrom(2);
        Int result_value = IntInit();
        Int huge         = IntFromStr("123456789012345678901234567890");
        Int base         = IntFrom(40);
        Int rhs          = IntFrom(2);
        Int result_value = IntInit();
        Int huge         = IntFromStr("123456789012345678901234567890");
        Str text         = StrInit();
        Int rhs          = IntFrom(2);
        Int result_value = IntInit();
        Int huge         = IntFromStr("123456789012345678901234567890");
        Str text         = StrInit();
        WriteFmt("Testing IntSub\n");
    
        Int a      = IntFrom(256);
        Int b      = IntFrom(1);
        Int result_value = IntInit();
    
        Int a      = IntFrom(256);
        Int b      = IntFrom(1);
        Int result_value = IntInit();
        Int a      = IntFrom(256);
        Int b      = IntFrom(1);
        Int result_value = IntInit();
    
        bool result = IntSub(&result_value, &a, &b);
        WriteFmt("Testing IntSub generic dispatch\n");
    
        Int base         = IntFrom(40);
        Int rhs          = IntFrom(2);
        Int result_value = IntInit();
    
        Int base         = IntFrom(40);
        Int rhs          = IntFrom(2);
        Int result_value = IntInit();
        Int preserved    = IntFrom(99);
        Int base         = IntFrom(40);
        Int rhs          = IntFrom(2);
        Int result_value = IntInit();
        Int preserved    = IntFrom(99);
        Int huge         = IntFromStr("12345678901234567890");
        Int rhs          = IntFrom(2);
        Int result_value = IntInit();
        Int preserved    = IntFrom(99);
        Int huge         = IntFromStr("12345678901234567890");
        Str text         = StrInit();
        Int result_value = IntInit();
        Int preserved    = IntFrom(99);
        Int huge         = IntFromStr("12345678901234567890");
        Str text         = StrInit();
        WriteFmt("Testing IntSub underflow handling\n");
    
        Int a      = IntFrom(3);
        Int b      = IntFrom(5);
        Int result_value = IntFrom(99);
    
        Int a      = IntFrom(3);
        Int b      = IntFrom(5);
        Int result_value = IntFrom(99);
        Int a      = IntFrom(3);
        Int b      = IntFrom(5);
        Int result_value = IntFrom(99);
    
        bool result = !IntSub(&result_value, &a, &b);
        WriteFmt("Testing IntMul\n");
    
        Int a      = IntFrom(21);
        Int b      = IntFrom(6);
        Int result_value = IntInit();
    
        Int a      = IntFrom(21);
        Int b      = IntFrom(6);
        Int result_value = IntInit();
        Int a      = IntFrom(21);
        Int b      = IntFrom(6);
        Int result_value = IntInit();
    
        IntMul(&result_value, &a, &b);
        WriteFmt("Testing IntMul generic dispatch\n");
    
        Int value = IntFromStr("12345678901234567890");
        Int result_value = IntInit();
        Str text = StrInit();
    
        Int value = IntFromStr("12345678901234567890");
        Int result_value = IntInit();
        Str text = StrInit();
        WriteFmt("Testing IntMul with zero\n");
    
        Int a      = IntFrom(0);
        Int b      = IntFrom(12345);
        Int result_value = IntInit();
    
        Int a      = IntFrom(0);
        Int b      = IntFrom(12345);
        Int result_value = IntInit();
        Int a      = IntFrom(0);
        Int b      = IntFrom(12345);
        Int result_value = IntInit();
    
        IntMul(&result_value, &a, &b);
        WriteFmt("Testing IntSquare\n");
    
        Int value = IntFrom(12345);
        Int result_value = IntInit();
    
        Int value = IntFrom(12345);
        Int result_value = IntInit();
    
        IntSquare(&result_value, &value);
        WriteFmt("Testing IntPow generic dispatch\n");
    
        Int base = IntFrom(7);
        Int exponent = IntFrom(20);
        Int result_value = IntInit();
    
        Int base = IntFrom(7);
        Int exponent = IntFrom(20);
        Int result_value = IntInit();
        Str text = StrInit();
        Int base = IntFrom(7);
        Int exponent = IntFrom(20);
        Int result_value = IntInit();
        Str text = StrInit();
        WriteFmt("Testing IntDivMod generic dispatch\n");
    
        Int dividend  = IntFromStr("12345678901234567890");
        Int quotient  = IntInit();
        Int remainder = IntInit();
    
        Int dividend  = IntFromStr("12345678901234567890");
        Int quotient  = IntInit();
        Int remainder = IntInit();
        Str qtext     = StrInit();
        Int dividend  = IntFromStr("12345678901234567890");
        Int quotient  = IntInit();
        Int remainder = IntInit();
        Str qtext     = StrInit();
        WriteFmt("Testing IntDiv generic dispatch\n");
    
        Int dividend = IntFrom(126);
        Int result_value = IntInit();
    
        Int dividend = IntFrom(126);
        Int result_value = IntInit();
    
        IntDiv(&result_value, &dividend, 10u);
        WriteFmt("Testing IntDivExact generic dispatch\n");
    
        Int dividend = IntFromStr("12345678901234567890");
        Int result_value = IntInit();
        Str text = StrInit();
    
        Int dividend = IntFromStr("12345678901234567890");
        Int result_value = IntInit();
        Str text = StrInit();
        WriteFmt("Testing IntDivExact failure handling\n");
    
        Int dividend = IntFrom(10);
        Int divisor = IntFrom(3);
        Int result_value = IntFrom(99);
    
        Int dividend = IntFrom(10);
        Int divisor = IntFrom(3);
        Int result_value = IntFrom(99);
        Int dividend = IntFrom(10);
        Int divisor = IntFrom(3);
        Int result_value = IntFrom(99);
    
        bool result = !IntDivExact(&result_value, &dividend, &divisor);
        WriteFmt("Testing IntDivMod scalar-divisor dispatch\n");
    
        Int dividend = IntFromStr("12345678901234567890");
        Int quotient = IntInit();
        Int remainder = IntInit();
    
        Int dividend = IntFromStr("12345678901234567890");
        Int quotient = IntInit();
        Int remainder = IntInit();
        Str text = StrInit();
        Int dividend = IntFromStr("12345678901234567890");
        Int quotient = IntInit();
        Int remainder = IntInit();
        Str text = StrInit();
        WriteFmt("Testing IntMod generic dispatch\n");
    
        Int dividend = IntFrom(126);
        Int result_value = IntInit();
    
        Int dividend = IntFrom(126);
        Int result_value = IntInit();
    
        IntMod(&result_value, &dividend, 10u);
        WriteFmt("Testing IntMod scalar-divisor dispatch\n");
    
        Int value = IntFromStr("12345678901234567890");
        Int remainder = IntInit();
    
        Int value = IntFromStr("12345678901234567890");
        Int remainder = IntInit();
    
        IntMod(&remainder, &value, 97u);
        WriteFmt("Testing IntGCD\n");
    
        Int a = IntFrom(48);
        Int b = IntFrom(18);
        Int result_value = IntInit();
    
        Int a = IntFrom(48);
        Int b = IntFrom(18);
        Int result_value = IntInit();
        Int a = IntFrom(48);
        Int b = IntFrom(18);
        Int result_value = IntInit();
    
        IntGCD(&result_value, &a, &b);
        WriteFmt("Testing IntLCM\n");
    
        Int a = IntFrom(21);
        Int b = IntFrom(6);
        Int result_value = IntInit();
    
        Int a = IntFrom(21);
        Int b = IntFrom(6);
        Int result_value = IntInit();
        Int a = IntFrom(21);
        Int b = IntFrom(6);
        Int result_value = IntInit();
    
        IntLCM(&result_value, &a, &b);
        WriteFmt("Testing IntRoot\n");
    
        Int value = IntFrom(4096);
        Int result_value = IntInit();
    
        Int value = IntFrom(4096);
        Int result_value = IntInit();
    
        IntRoot(&result_value, &value, 4);
        WriteFmt("Testing IntRootRem\n");
    
        Int value = IntFrom(200);
        Int root = IntInit();
        Int remainder = IntInit();
    
        Int value = IntFrom(200);
        Int root = IntInit();
        Int remainder = IntInit();
        Int value = IntFrom(200);
        Int root = IntInit();
        Int remainder = IntInit();
    
        IntRootRem(&root, &remainder, &value, 3);
        WriteFmt("Testing IntSqrt\n");
    
        Int value = IntFrom(200);
        Int result_value = IntInit();
    
        Int value = IntFrom(200);
        Int result_value = IntInit();
    
        IntSqrt(&result_value, &value);
        WriteFmt("Testing IntSqrtRem\n");
    
        Int value = IntFrom(200);
        Int root = IntInit();
        Int remainder = IntInit();
    
        Int value = IntFrom(200);
        Int root = IntInit();
        Int remainder = IntInit();
        Int value = IntFrom(200);
        Int root = IntInit();
        Int remainder = IntInit();
    
        IntSqrtRem(&root, &remainder, &value);
        WriteFmt("Testing IntIsPerfectSquare\n");
    
        Int square = IntFrom(144);
        Int non_square = IntFrom(145);
    
        Int square = IntFrom(144);
        Int non_square = IntFrom(145);
    
        bool result = IntIsPerfectSquare(&square);
        WriteFmt("Testing IntIsPerfectPower\n");
    
        Int power = IntFrom(81);
        Int non_power = IntFrom(82);
        Int one = IntFrom(1);
    
        Int power = IntFrom(81);
        Int non_power = IntFrom(82);
        Int one = IntFrom(1);
        Int power = IntFrom(81);
        Int non_power = IntFrom(82);
        Int one = IntFrom(1);
    
        bool result = IntIsPerfectPower(&power);
        WriteFmt("Testing IntJacobi\n");
    
        Int a = IntFrom(5);
        Int p = IntFrom(7);
        Int b = IntFrom(9);
    
        Int a = IntFrom(5);
        Int p = IntFrom(7);
        Int b = IntFrom(9);
        Int n = IntFrom(21);
        Int a = IntFrom(5);
        Int p = IntFrom(7);
        Int b = IntFrom(9);
        Int n = IntFrom(21);
        Int p = IntFrom(7);
        Int b = IntFrom(9);
        Int n = IntFrom(21);
    
        bool result = IntJacobi(&a, &p) == -1;
        WriteFmt("Testing IntSquareMod\n");
    
        Int value = IntFrom(12345);
        Int mod = IntFrom(97);
        Int result_value = IntInit();
    
        Int value = IntFrom(12345);
        Int mod = IntFrom(97);
        Int result_value = IntInit();
        Int value = IntFrom(12345);
        Int mod = IntFrom(97);
        Int result_value = IntInit();
    
        IntSquareMod(&result_value, &value, &mod);
        WriteFmt("Testing IntModAdd\n");
    
        Int a = IntFrom(100);
        Int b = IntFrom(250);
        Int m = IntFrom(13);
    
        Int a = IntFrom(100);
        Int b = IntFrom(250);
        Int m = IntFrom(13);
        Int result_value = IntInit();
        Int a = IntFrom(100);
        Int b = IntFrom(250);
        Int m = IntFrom(13);
        Int result_value = IntInit();
        Int b = IntFrom(250);
        Int m = IntFrom(13);
        Int result_value = IntInit();
    
        IntModAdd(&result_value, &a, &b, &m);
        WriteFmt("Testing IntModSub\n");
    
        Int a = IntFrom(5);
        Int b = IntFrom(9);
        Int m = IntFrom(13);
    
        Int a = IntFrom(5);
        Int b = IntFrom(9);
        Int m = IntFrom(13);
        Int result_value = IntInit();
        Int a = IntFrom(5);
        Int b = IntFrom(9);
        Int m = IntFrom(13);
        Int result_value = IntInit();
        Int b = IntFrom(9);
        Int m = IntFrom(13);
        Int result_value = IntInit();
    
        IntModSub(&result_value, &a, &b, &m);
        WriteFmt("Testing IntModMul\n");
    
        Int a = IntFrom(123);
        Int b = IntFrom(456);
        Int m = IntFrom(97);
    
        Int a = IntFrom(123);
        Int b = IntFrom(456);
        Int m = IntFrom(97);
        Int result_value = IntInit();
        Int a = IntFrom(123);
        Int b = IntFrom(456);
        Int m = IntFrom(97);
        Int result_value = IntInit();
        Int b = IntFrom(456);
        Int m = IntFrom(97);
        Int result_value = IntInit();
    
        IntModMul(&result_value, &a, &b, &m);
        WriteFmt("Testing IntModDiv\n");
    
        Int a = IntFrom(10);
        Int b = IntFrom(3);
        Int m = IntFrom(13);
    
        Int a = IntFrom(10);
        Int b = IntFrom(3);
        Int m = IntFrom(13);
        Int result_value = IntInit();
        Int a = IntFrom(10);
        Int b = IntFrom(3);
        Int m = IntFrom(13);
        Int result_value = IntInit();
        Int check = IntInit();
        Int b = IntFrom(3);
        Int m = IntFrom(13);
        Int result_value = IntInit();
        Int check = IntInit();
        Int m = IntFrom(13);
        Int result_value = IntInit();
        Int check = IntInit();
    
        bool result = IntModDiv(&result_value, &a, &b, &m);
        WriteFmt("Testing IntPowMod scalar-exponent dispatch\n");
    
        Int base = IntFrom(7);
        Int mod = IntFrom(13);
        Int result_value = IntInit();
    
        Int base = IntFrom(7);
        Int mod = IntFrom(13);
        Int result_value = IntInit();
        Int base = IntFrom(7);
        Int mod = IntFrom(13);
        Int result_value = IntInit();
    
        IntPowMod(&result_value, &base, 20u, &mod);
    
    bool test_int_pow_mod_integer_exponent(void) {
        WriteFmt("Testing IntPowMod Int-exponent dispatch\n");
    
        Int base = IntFrom(4);
        WriteFmt("Testing IntPowMod Int-exponent dispatch\n");
    
        Int base = IntFrom(4);
        Int exp = IntFrom(13);
        Int mod = IntFrom(497);
    
        Int base = IntFrom(4);
        Int exp = IntFrom(13);
        Int mod = IntFrom(497);
        Int result_value = IntInit();
        Int base = IntFrom(4);
        Int exp = IntFrom(13);
        Int mod = IntFrom(497);
        Int result_value = IntInit();
        Int exp = IntFrom(13);
        Int mod = IntFrom(497);
        Int result_value = IntInit();
    
        IntPowMod(&result_value, &base, &exp, &mod);
        WriteFmt("Testing IntModInv\n");
    
        Int value = IntFrom(3);
        Int mod = IntFrom(11);
        Int result_value = IntInit();
    
        Int value = IntFrom(3);
        Int mod = IntFrom(11);
        Int result_value = IntInit();
        Int check = IntInit();
        Int value = IntFrom(3);
        Int mod = IntFrom(11);
        Int result_value = IntInit();
        Int check = IntInit();
        Int mod = IntFrom(11);
        Int result_value = IntInit();
        Int check = IntInit();
    
        bool result = IntModInv(&result_value, &value, &mod);
        WriteFmt("Testing IntModSqrt\n");
    
        Int value = IntFrom(10);
        Int mod = IntFrom(13);
        Int root = IntInit();
    
        Int value = IntFrom(10);
        Int mod = IntFrom(13);
        Int root = IntInit();
        Int check = IntInit();
        Int value = IntFrom(10);
        Int mod = IntFrom(13);
        Int root = IntInit();
        Int check = IntInit();
        Int mod = IntFrom(13);
        Int root = IntInit();
        Int check = IntInit();
    
        bool result = IntModSqrt(&root, &value, &mod);
        WriteFmt("Testing IntModSqrt no-solution case\n");
    
        Int value = IntFrom(3);
        Int mod = IntFrom(7);
        Int root = IntFrom(99);
    
        Int value = IntFrom(3);
        Int mod = IntFrom(7);
        Int root = IntFrom(99);
        Int value = IntFrom(3);
        Int mod = IntFrom(7);
        Int root = IntFrom(99);
    
        bool result = !IntModSqrt(&root, &value, &mod);
        WriteFmt("Testing IntIsProbablePrime\n");
    
        Int prime = IntFromStr("1000000007");
        Int composite = IntFrom(561);
    
        Int prime = IntFromStr("1000000007");
        Int composite = IntFrom(561);
    
        bool result = IntIsProbablePrime(&prime);
        WriteFmt("Testing IntNextPrime\n");
    
        Int value = IntFromStr("1000000000");
        Int next = IntInit();
        Str text = StrInit();
    
        Int value = IntFromStr("1000000000");
        Int next = IntInit();
        Str text = StrInit();
        WriteFmt("Testing IntModInv no-solution case\n");
    
        Int value = IntFrom(6);
        Int mod = IntFrom(15);
        Int result_value = IntFrom(99);
    
        Int value = IntFrom(6);
        Int mod = IntFrom(15);
        Int result_value = IntFrom(99);
        Int value = IntFrom(6);
        Int mod = IntFrom(15);
        Int result_value = IntFrom(99);
    
        bool result = !IntModInv(&result_value, &value, &mod);
        WriteFmt("Testing IntModDiv no-solution case\n");
    
        Int a = IntFrom(1);
        Int b = IntFrom(6);
        Int m = IntFrom(15);
    
        Int a = IntFrom(1);
        Int b = IntFrom(6);
        Int m = IntFrom(15);
        Int result_value = IntFrom(99);
        Int a = IntFrom(1);
        Int b = IntFrom(6);
        Int m = IntFrom(15);
        Int result_value = IntFrom(99);
        Int b = IntFrom(6);
        Int m = IntFrom(15);
        Int result_value = IntFrom(99);
    
        bool result = !IntModDiv(&result_value, &a, &b, &m);
        WriteFmt("Testing IntAdd NULL result handling\n");
    
        Int a = IntFrom(1);
        Int b = IntFrom(2);
    
        Int a = IntFrom(1);
        Int b = IntFrom(2);
    
        IntAdd(NULL, &a, &b);
    
    bool test_int_div_by_zero(void) {
        WriteFmt("Testing Int division by zero handling\n");
    
        Int dividend  = IntFrom(1);
        WriteFmt("Testing Int division by zero handling\n");
    
        Int dividend  = IntFrom(1);
        Int divisor   = IntInit();
        Int quotient  = IntInit();
    
        Int dividend  = IntFrom(1);
        Int divisor   = IntInit();
        Int quotient  = IntInit();
        Int remainder = IntInit();
        Int dividend  = IntFrom(1);
        Int divisor   = IntInit();
        Int quotient  = IntInit();
        Int remainder = IntInit();
        Int divisor   = IntInit();
        Int quotient  = IntInit();
        Int remainder = IntInit();
    
        IntDivMod(&quotient, &remainder, &dividend, &divisor);
        WriteFmt("Testing IntRoot zero-degree handling\n");
    
        Int value = IntFrom(16);
        Int root = IntInit();
        Int remainder = IntInit();
    
        Int value = IntFrom(16);
        Int root = IntInit();
        Int remainder = IntInit();
        Int value = IntFrom(16);
        Int root = IntInit();
        Int remainder = IntInit();
    
        IntRootRem(&root, &remainder, &value, 0);
        WriteFmt("Testing IntDiv scalar zero-divisor handling\n");
    
        Int dividend = IntFrom(10);
        Int quotient = IntInit();
    
        Int dividend = IntFrom(10);
        Int quotient = IntInit();
    
        IntDiv(&quotient, &dividend, 0u);
        WriteFmt("Testing IntMod scalar zero-modulus handling\n");
    
        Int value = IntFrom(10);
        Int result_value = IntInit();
    
        Int value = IntFrom(10);
        Int result_value = IntInit();
    
        IntMod(&result_value, &value, 0u);
        WriteFmt("Testing IntModDiv zero modulus handling\n");
    
        Int a = IntFrom(10);
        Int b = IntFrom(3);
        Int m = IntInit();
    
        Int a = IntFrom(10);
        Int b = IntFrom(3);
        Int m = IntInit();
        Int result_value = IntInit();
        Int a = IntFrom(10);
        Int b = IntFrom(3);
        Int m = IntInit();
        Int result_value = IntInit();
        Int b = IntFrom(3);
        Int m = IntInit();
        Int result_value = IntInit();
    
        (void)IntModDiv(&result_value, &a, &b, &m);
        WriteFmt("Testing IntJacobi even denominator handling\n");
    
        Int a = IntFrom(3);
        Int n = IntFrom(8);
    
        Int a = IntFrom(3);
        Int n = IntFrom(8);
    
        (void)IntJacobi(&a, &n);
        WriteFmt("Testing IntPowMod scalar-exponent zero modulus handling\n");
    
        Int base = IntFrom(2);
        Int mod = IntInit();
        Int result_value = IntInit();
    
        Int base = IntFrom(2);
        Int mod = IntInit();
        Int result_value = IntInit();
        Int base = IntFrom(2);
        Int mod = IntInit();
        Int result_value = IntInit();
    
        IntPowMod(&result_value, &base, 8u, &mod);
    
    bool test_int_pow_mod_integer_zero_modulus(void) {
        WriteFmt("Testing IntPowMod Int-exponent zero modulus handling\n");
    
        Int base = IntFrom(2);
        WriteFmt("Testing IntPowMod Int-exponent zero modulus handling\n");
    
        Int base = IntFrom(2);
        Int exp = IntFrom(8);
        Int mod = IntInit();
    
        Int base = IntFrom(2);
        Int exp = IntFrom(8);
        Int mod = IntInit();
        Int result_value = IntInit();
        Int base = IntFrom(2);
        Int exp = IntFrom(8);
        Int mod = IntInit();
        Int result_value = IntInit();
        Int exp = IntFrom(8);
        Int mod = IntInit();
        Int result_value = IntInit();
    
        IntPowMod(&result_value, &base, &exp, &mod);
    
    int main(void) {
        WriteFmt("[INFO] Starting Int.Math tests\n\n");
    
        TestFunction tests[] = {
        int total_deadend_tests = sizeof(deadend_tests) / sizeof(deadend_tests[0]);
    
        return run_test_suite(tests, total_tests, deadend_tests, total_deadend_tests, "Int.Math");
    }
    #include <Misra/Std/Container/Int.h>
    #include <Misra/Std/Log.h>
    #include <Misra/Types.h>
        WriteFmt("Testing IntInit\n");
    
        Int value = IntInit();
    
        bool result = IntIsZero(&value);
        WriteFmt("Testing IntClear\n");
    
        Int value = IntFromBinary("101101");
    
        IntClear(&value);
        WriteFmt("Testing IntClone\n");
    
        Int original = IntFromBinary("1011");
        Int clone    = IntClone(&original);
    
        Int original = IntFromBinary("1011");
        Int clone    = IntClone(&original);
    
        bool result = IntEQ(&clone, &original);
    
    int main(void) {
        WriteFmt("[INFO] Starting Int.Type tests\n\n");
    
        TestFunction tests[] = {
    
        int total_tests = sizeof(tests) / sizeof(tests[0]);
        return run_test_suite(tests, total_tests, NULL, 0, "Int.Type");
    }
                Str: TO_TYPE_SPECIFIC_IO(Str, &(x)),                                                                       \
                Float: TO_TYPE_SPECIFIC_IO(Float, &(x)),                                                                   \
                Int: TO_TYPE_SPECIFIC_IO(Int, &(x)),                                                                       \
                BitVec: TO_TYPE_SPECIFIC_IO(BitVec, &(x)),                                                                 \
                const char *: TO_TYPE_SPECIFIC_IO(Zstr, &(x)),                                                             \
                Str: TO_TYPE_SPECIFIC_IO(Str, (void *)&(x)),                                                               \
                Float: TO_TYPE_SPECIFIC_IO(Float, (void *)&(x)),                                                           \
                Int: TO_TYPE_SPECIFIC_IO(Int, (void *)&(x)),                                                               \
                BitVec: TO_TYPE_SPECIFIC_IO(BitVec, (void *)&(x)),                                                         \
                const char *: TO_TYPE_SPECIFIC_IO(Zstr, (void *)&(x)),                                                     \
    void _write_Float(Str *o, FmtInfo *fmt_info, Float *value);
    void _write_BitVec(Str *o, FmtInfo *fmt_info, BitVec *bv);
    void _write_Int(Str *o, FmtInfo *fmt_info, Int *value);
    
    const char *_read_Str(const char *i, FmtInfo *fmt_info, Str *s);
    const char *_read_Float(const char *i, FmtInfo *fmt_info, Float *value);
    const char *_read_BitVec(const char *i, FmtInfo *fmt_info, BitVec *bv);
    const char *_read_Int(const char *i, FmtInfo *fmt_info, Int *value);
    
    #endif // MISRA_STD_IO
    #include <Misra/Std/Container/Map.h>
    #include <Misra/Std/Container/BitVec.h>
    #include <Misra/Std/Container/Int.h>
    #include <Misra/Std/Container/Float.h>
    #define MISRA_STD_CONTAINER_INT_H
    
    #include "Int/Type.h"
    #include "Int/Init.h"
    #include "Int/Access.h"
    
    #include "Int/Type.h"
    #include "Int/Init.h"
    #include "Int/Access.h"
    #include "Int/Memory.h"
    #include "Int/Type.h"
    #include "Int/Init.h"
    #include "Int/Access.h"
    #include "Int/Memory.h"
    #include "Int/Convert.h"
    #include "Int/Init.h"
    #include "Int/Access.h"
    #include "Int/Memory.h"
    #include "Int/Convert.h"
    #include "Int/Private.h"
    #include "Int/Access.h"
    #include "Int/Memory.h"
    #include "Int/Convert.h"
    #include "Int/Private.h"
    #include "Int/Compare.h"
    #include "Int/Memory.h"
    #include "Int/Convert.h"
    #include "Int/Private.h"
    #include "Int/Compare.h"
    #include "Int/Math.h"
    #include "Int/Convert.h"
    #include "Int/Private.h"
    #include "Int/Compare.h"
    #include "Int/Math.h"
    #include "Int/Private.h"
    #include "Int/Compare.h"
    #include "Int/Math.h"
    
    #endif // MISRA_STD_CONTAINER_INT_H
    /// TAGS: Int, Math, ShiftLeft, Bits
    ///
    void IntShiftLeft(Int *value, u64 positions);
    ///
    /// Shift an integer right by the given number of bit positions.
    /// TAGS: Int, Math, ShiftRight, Bits
    ///
    void IntShiftRight(Int *value, u64 positions);
    ///
    /// Add two integers.
    /// TAGS: Int, Math, Add
    ///
    void (IntAdd)(Int *result, Int *a, Int *b);
    ///
    /// Subtract one integer from another.
    /// TAGS: Int, Math, Subtract
    ///
    bool (IntSub)(Int *result, Int *a, Int *b);
    ///
    /// Multiply two integers.
    /// TAGS: Int, Math, Multiply
    ///
    void (IntMul)(Int *result, Int *a, Int *b);
    ///
    /// Square an integer.
    /// TAGS: Int, Math, Square
    ///
    void IntSquare(Int *result, Int *value);
    ///
    /// Raise an integer to an arbitrary-precision power.
    /// TAGS: Int, Math, Power, Exponentiation
    ///
    void (IntPow)(Int *result, Int *base, Int *exponent);
    ///
    /// Divide one integer by another using floor division.
    /// TAGS: Int, Math, Divide, Quotient
    ///
    void (IntDiv)(Int *result, Int *dividend, Int *divisor);
    ///
    /// Divide one integer by another only when the division is exact.
    /// TAGS: Int, Math, DivideExact
    ///
    bool (IntDivExact)(Int *result, Int *dividend, Int *divisor);
    ///
    /// Compute `dividend mod divisor`.
    /// TAGS: Int, Math, Modulo
    ///
    void (IntMod)(Int *result, Int *dividend, Int *divisor);
    ///
    /// Compute quotient and remainder in one call.
    /// TAGS: Int, Math, Divide, Modulo
    ///
    void (IntDivMod)(Int *quotient, Int *remainder, Int *dividend, Int *divisor);
    ///
    /// Compute the greatest common divisor of two integers.
    /// TAGS: Int, Math, GCD, NumberTheory
    ///
    void IntGCD(Int *result, Int *a, Int *b);
    ///
    /// Compute the least common multiple of two integers.
    /// TAGS: Int, Math, LCM, NumberTheory
    ///
    void IntLCM(Int *result, Int *a, Int *b);
    ///
    /// Compute the integer `degree`-th root of a value.
    /// TAGS: Int, Math, Root, NumberTheory
    ///
    void IntRoot(Int *result, Int *value, u64 degree);
    ///
    /// Compute an integer root and the leftover remainder.
    /// TAGS: Int, Math, Root, Remainder
    ///
    void IntRootRem(Int *root, Int *remainder, Int *value, u64 degree);
    ///
    /// Compute the integer square root.
    /// TAGS: Int, Math, Sqrt
    ///
    void IntSqrt(Int *result, Int *value);
    ///
    /// Compute the integer square root and remainder.
    /// TAGS: Int, Math, Sqrt, Remainder
    ///
    void IntSqrtRem(Int *root, Int *remainder, Int *value);
    ///
    /// Test whether a value is a perfect square.
    /// TAGS: Int, Math, PerfectSquare, Predicate
    ///
    bool IntIsPerfectSquare(Int *value);
    ///
    /// Test whether a value is a perfect power.
    /// TAGS: Int, Math, PerfectPower, Predicate
    ///
    bool IntIsPerfectPower(Int *value);
    ///
    /// Compute the Jacobi symbol `(a/n)`.
    /// TAGS: Int, Math, Jacobi, NumberTheory
    ///
    int  IntJacobi(Int *a, Int *n);
    ///
    /// Compute `(value^2) mod modulus`.
    /// TAGS: Int, Math, Modular, Square
    ///
    void IntSquareMod(Int *result, Int *value, Int *modulus);
    ///
    /// Compute `(a + b) mod modulus`.
    /// TAGS: Int, Math, Modular, Add
    ///
    void IntModAdd(Int *result, Int *a, Int *b, Int *modulus);
    ///
    /// Compute `(a - b) mod modulus`.
    /// TAGS: Int, Math, Modular, Subtract
    ///
    void IntModSub(Int *result, Int *a, Int *b, Int *modulus);
    ///
    /// Compute `(a * b) mod modulus`.
    /// TAGS: Int, Math, Modular, Multiply
    ///
    void IntModMul(Int *result, Int *a, Int *b, Int *modulus);
    ///
    /// Compute modular division `a / b (mod modulus)`.
    /// TAGS: Int, Math, Modular, Divide
    ///
    bool IntModDiv(Int *result, Int *a, Int *b, Int *modulus);
    ///
    /// Compute `(base^exponent) mod modulus`.
    /// TAGS: Int, Math, Modular, Power
    ///
    void (IntPowMod)(Int *result, Int *base, Int *exponent, Int *modulus);
    ///
    /// Compute the multiplicative inverse of a value modulo `modulus`.
    /// TAGS: Int, Math, Modular, Inverse
    ///
    bool IntModInv(Int *result, Int *value, Int *modulus);
    ///
    /// Compute a modular square root.
    /// TAGS: Int, Math, Modular, Sqrt
    ///
    bool IntModSqrt(Int *result, Int *value, Int *modulus);
    ///
    /// Perform a probabilistic primality test.
    /// TAGS: Int, Math, Prime, Predicate
    ///
    bool IntIsProbablePrime(Int *value);
    ///
    /// Find the next probable prime greater than or equal to a value.
    /// TAGS: Int, Math, Prime, Search
    ///
    void IntNextPrime(Int *result, Int *value);
    
    #ifndef __cplusplus
            _Generic(                                                                                                      \
                (rhs),                                                                                                     \
                Int: MISRA_PRIV_IntAddValue,                                                                               \
                Int *: IntAdd,                                                                                             \
                const Int *: MISRA_PRIV_IntAddConst,                                                                       \
                (rhs),                                                                                                     \
                Int: MISRA_PRIV_IntAddValue,                                                                               \
                Int *: IntAdd,                                                                                             \
                const Int *: MISRA_PRIV_IntAddConst,                                                                       \
                unsigned char: MISRA_PRIV_IntAddU64,                                                                       \
                Int: MISRA_PRIV_IntAddValue,                                                                               \
                Int *: IntAdd,                                                                                             \
                const Int *: MISRA_PRIV_IntAddConst,                                                                       \
                unsigned char: MISRA_PRIV_IntAddU64,                                                                       \
                unsigned short: MISRA_PRIV_IntAddU64,                                                                      \
            _Generic(                                                                                                      \
                (rhs),                                                                                                     \
                Int: MISRA_PRIV_IntSubValue,                                                                               \
                Int *: IntSub,                                                                                             \
                const Int *: MISRA_PRIV_IntSubConst,                                                                       \
                (rhs),                                                                                                     \
                Int: MISRA_PRIV_IntSubValue,                                                                               \
                Int *: IntSub,                                                                                             \
                const Int *: MISRA_PRIV_IntSubConst,                                                                       \
                unsigned char: MISRA_PRIV_IntSubU64,                                                                       \
                Int: MISRA_PRIV_IntSubValue,                                                                               \
                Int *: IntSub,                                                                                             \
                const Int *: MISRA_PRIV_IntSubConst,                                                                       \
                unsigned char: MISRA_PRIV_IntSubU64,                                                                       \
                unsigned short: MISRA_PRIV_IntSubU64,                                                                      \
            _Generic(                                                                                                      \
                (rhs),                                                                                                     \
                Int: MISRA_PRIV_IntMulValue,                                                                               \
                Int *: IntMul,                                                                                             \
                const Int *: MISRA_PRIV_IntMulConst,                                                                       \
                (rhs),                                                                                                     \
                Int: MISRA_PRIV_IntMulValue,                                                                               \
                Int *: IntMul,                                                                                             \
                const Int *: MISRA_PRIV_IntMulConst,                                                                       \
                unsigned char: MISRA_PRIV_IntMulU64,                                                                       \
                Int: MISRA_PRIV_IntMulValue,                                                                               \
                Int *: IntMul,                                                                                             \
                const Int *: MISRA_PRIV_IntMulConst,                                                                       \
                unsigned char: MISRA_PRIV_IntMulU64,                                                                       \
                unsigned short: MISRA_PRIV_IntMulU64,                                                                      \
            _Generic(                                                                                                      \
                (exponent),                                                                                                \
                Int: MISRA_PRIV_IntPowValue,                                                                               \
                Int *: IntPow,                                                                                             \
                const Int *: MISRA_PRIV_IntPowConst,                                                                       \
                (exponent),                                                                                                \
                Int: MISRA_PRIV_IntPowValue,                                                                               \
                Int *: IntPow,                                                                                             \
                const Int *: MISRA_PRIV_IntPowConst,                                                                       \
                unsigned char: MISRA_PRIV_IntPowU64,                                                                       \
                Int: MISRA_PRIV_IntPowValue,                                                                               \
                Int *: IntPow,                                                                                             \
                const Int *: MISRA_PRIV_IntPowConst,                                                                       \
                unsigned char: MISRA_PRIV_IntPowU64,                                                                       \
                unsigned short: MISRA_PRIV_IntPowU64,                                                                      \
            _Generic(                                                                                                      \
                (divisor),                                                                                                 \
                Int: MISRA_PRIV_IntDivValue,                                                                               \
                Int *: IntDiv,                                                                                             \
                const Int *: MISRA_PRIV_IntDivConst,                                                                       \
                (divisor),                                                                                                 \
                Int: MISRA_PRIV_IntDivValue,                                                                               \
                Int *: IntDiv,                                                                                             \
                const Int *: MISRA_PRIV_IntDivConst,                                                                       \
                unsigned char: MISRA_PRIV_IntDivU64,                                                                       \
                Int: MISRA_PRIV_IntDivValue,                                                                               \
                Int *: IntDiv,                                                                                             \
                const Int *: MISRA_PRIV_IntDivConst,                                                                       \
                unsigned char: MISRA_PRIV_IntDivU64,                                                                       \
                unsigned short: MISRA_PRIV_IntDivU64,                                                                      \
            _Generic(                                                                                                      \
                (divisor),                                                                                                 \
                Int: MISRA_PRIV_IntDivExactValue,                                                                          \
                Int *: IntDivExact,                                                                                        \
                const Int *: MISRA_PRIV_IntDivExactConst,                                                                  \
                (divisor),                                                                                                 \
                Int: MISRA_PRIV_IntDivExactValue,                                                                          \
                Int *: IntDivExact,                                                                                        \
                const Int *: MISRA_PRIV_IntDivExactConst,                                                                  \
                unsigned char: MISRA_PRIV_IntDivExactU64,                                                                  \
                Int: MISRA_PRIV_IntDivExactValue,                                                                          \
                Int *: IntDivExact,                                                                                        \
                const Int *: MISRA_PRIV_IntDivExactConst,                                                                  \
                unsigned char: MISRA_PRIV_IntDivExactU64,                                                                  \
                unsigned short: MISRA_PRIV_IntDivExactU64,                                                                 \
            _Generic(                                                                                                      \
                (divisor),                                                                                                 \
                Int: MISRA_PRIV_IntModValue,                                                                               \
                Int *: IntMod,                                                                                             \
                const Int *: MISRA_PRIV_IntModConst,                                                                       \
                (divisor),                                                                                                 \
                Int: MISRA_PRIV_IntModValue,                                                                               \
                Int *: IntMod,                                                                                             \
                const Int *: MISRA_PRIV_IntModConst,                                                                       \
                unsigned char: MISRA_PRIV_IntModU64Into,                                                                   \
                Int: MISRA_PRIV_IntModValue,                                                                               \
                Int *: IntMod,                                                                                             \
                const Int *: MISRA_PRIV_IntModConst,                                                                       \
                unsigned char: MISRA_PRIV_IntModU64Into,                                                                   \
                unsigned short: MISRA_PRIV_IntModU64Into,                                                                  \
            _Generic(                                                                                                      \
                (divisor),                                                                                                 \
                Int: MISRA_PRIV_IntDivModValue,                                                                            \
                Int *: IntDivMod,                                                                                          \
                const Int *: MISRA_PRIV_IntDivModConst,                                                                    \
                (divisor),                                                                                                 \
                Int: MISRA_PRIV_IntDivModValue,                                                                            \
                Int *: IntDivMod,                                                                                          \
                const Int *: MISRA_PRIV_IntDivModConst,                                                                    \
                unsigned char: MISRA_PRIV_IntDivModU64,                                                                    \
                Int: MISRA_PRIV_IntDivModValue,                                                                            \
                Int *: IntDivMod,                                                                                          \
                const Int *: MISRA_PRIV_IntDivModConst,                                                                    \
                unsigned char: MISRA_PRIV_IntDivModU64,                                                                    \
                unsigned short: MISRA_PRIV_IntDivModU64,                                                                   \
            _Generic(                                                                                                      \
                (exponent),                                                                                                \
                Int: MISRA_PRIV_IntPowModValue,                                                                            \
                Int *: IntPowMod,                                                                                          \
                const Int *: MISRA_PRIV_IntPowModConst,                                                                    \
                (exponent),                                                                                                \
                Int: MISRA_PRIV_IntPowModValue,                                                                            \
                Int *: IntPowMod,                                                                                          \
                const Int *: MISRA_PRIV_IntPowModConst,                                                                    \
                unsigned char: MISRA_PRIV_IntPowU64Mod,                                                                    \
                Int: MISRA_PRIV_IntPowModValue,                                                                            \
                Int *: IntPowMod,                                                                                          \
                const Int *: MISRA_PRIV_IntPowModConst,                                                                    \
                unsigned char: MISRA_PRIV_IntPowU64Mod,                                                                    \
                unsigned short: MISRA_PRIV_IntPowU64Mod,                                                                   \
    /// TAGS: Int, Convert, U64, Export
    ///
    u64 IntToU64(Int *value);
    
    ///
    /// TAGS: Int, Convert, Bytes, LittleEndian, Import
    ///
    Int IntFromBytesLE(const u8 *bytes, u64 len);
    
    ///
    /// TAGS: Int, Convert, Bytes, LittleEndian, Export
    ///
    u64 IntToBytesLE(Int *value, u8 *bytes, u64 max_len);
    
    ///
    /// TAGS: Int, Convert, Bytes, BigEndian, Import
    ///
    Int IntFromBytesBE(const u8 *bytes, u64 len);
    
    ///
    /// TAGS: Int, Convert, Bytes, BigEndian, Export
    ///
    u64 IntToBytesBE(Int *value, u8 *bytes, u64 max_len);
    
    ///
    /// TAGS: Int, Convert, String, Radix, Import
    ///
    Int IntFromStrRadix(const char *digits, u8 radix);
    
    ///
    /// TAGS: Int, Convert, String, Radix, Export
    ///
    Str IntToStrRadix(Int *value, u8 radix, bool uppercase);
    
    ///
    /// TAGS: Int, Convert, Decimal, String, Import
    ///
    Int IntFromStr(const char *decimal);
    
    ///
    /// TAGS: Int, Convert, Decimal, String, Export
    ///
    Str IntToStr(Int *value);
    
    ///
    /// TAGS: Int, Convert, Binary, String, Import
    ///
    Int IntFromBinary(const char *binary);
    
    ///
    /// TAGS: Int, Convert, Binary, String, Export
    ///
    Str IntToBinary(Int *value);
    
    ///
    /// TAGS: Int, Convert, Octal, String, Import
    ///
    Int IntFromOctStr(const char *octal);
    
    ///
    /// TAGS: Int, Convert, Octal, String, Export
    ///
    Str IntToOctStr(Int *value);
    
    ///
    /// TAGS: Int, Convert, Hex, String, Import
    ///
    Int IntFromHexStr(const char *hex);
    
    ///
    /// TAGS: Int, Convert, Hex, String, Export
    ///
    Str IntToHexStr(Int *value);
    
    #ifdef __cplusplus
    /// TAGS: Int, Compare, Ordering
    ///
    int (IntCompare)(Int *lhs, Int *rhs);
    
    #ifndef __cplusplus
            _Generic(                                                                                                      \
                (rhs),                                                                                                     \
                Int: MISRA_PRIV_IntCompareValue,                                                                           \
                Int *: IntCompare,                                                                                         \
                const Int *: MISRA_PRIV_IntCompareConst,                                                                   \
                (rhs),                                                                                                     \
                Int: MISRA_PRIV_IntCompareValue,                                                                           \
                Int *: IntCompare,                                                                                         \
                const Int *: MISRA_PRIV_IntCompareConst,                                                                   \
                unsigned char: MISRA_PRIV_IntCompareU64,                                                                   \
                Int: MISRA_PRIV_IntCompareValue,                                                                           \
                Int *: IntCompare,                                                                                         \
                const Int *: MISRA_PRIV_IntCompareConst,                                                                   \
                unsigned char: MISRA_PRIV_IntCompareU64,                                                                   \
                unsigned short: MISRA_PRIV_IntCompareU64,                                                                  \
    /// TAGS: Int, Init, Zero, Construct
    ///
    static inline Int IntInit(void) {
        Int value;
    ///
    static inline Int IntInit(void) {
        Int value;
    
        value.bits = BitVecInit();
    /// TAGS: Int, Deinit, Destroy, Memory
    ///
    static inline void IntDeinit(Int *value) {
        ValidateInt(value);
        BitVecDeinit(&value->bits);
    /// TAGS: Int, Clear, Zero, Reset
    ///
    static inline void IntClear(Int *value) {
        ValidateInt(value);
        BitVecClear(&value->bits);
    /// TAGS: Int, Memory, Clone, Copy
    ///
    Int IntClone(Int *value);
    
    #ifdef __cplusplus
    /// TAGS: Int, Access, Bits, Length
    ///
    u64  IntBitLength(Int *value);
    
    ///
    /// TAGS: Int, Access, Bytes, Length
    ///
    u64  IntByteLength(Int *value);
    
    ///
    /// TAGS: Int, Access, Log2, Bits
    ///
    u64  IntLog2(Int *value);
    
    ///
    /// TAGS: Int, Access, TrailingZeroes, Bits
    ///
    u64  IntTrailingZeroCount(Int *value);
    
    ///
    /// TAGS: Int, Access, Zero, Predicate
    ///
    bool IntIsZero(Int *value);
    
    ///
    /// TAGS: Int, Access, One, Predicate
    ///
    bool IntIsOne(Int *value);
    
    ///
    /// TAGS: Int, Access, Even, Predicate
    ///
    bool IntIsEven(Int *value);
    
    ///
    /// TAGS: Int, Access, Odd, Predicate
    ///
    bool IntIsOdd(Int *value);
    
    ///
    /// TAGS: Int, Access, Convert, Range
    ///
    bool IntFitsU64(Int *value);
    
    ///
    /// TAGS: Int, Access, PowerOfTwo, Predicate
    ///
    bool IntIsPowerOfTwo(Int *value);
    
    #ifdef __cplusplus
    typedef struct {
        BitVec bits;
    } Int;
    
    ///
    /// TAGS: Int, Validate, Safety, Debug
    ///
    static inline void ValidateInt(const Int *value) {
        ValidateBitVec(value ? &value->bits : NULL);
    }
                Float *: FloatAdd,                                                                                         \
                const Float *: MISRA_PRIV_FloatAddConstFloat,                                                              \
                Int: MISRA_PRIV_FloatAddValueInt,                                                                          \
                Int *: MISRA_PRIV_FloatAddInt,                                                                             \
                const Int *: MISRA_PRIV_FloatAddConstInt,                                                                  \
                const Float *: MISRA_PRIV_FloatAddConstFloat,                                                              \
                Int: MISRA_PRIV_FloatAddValueInt,                                                                          \
                Int *: MISRA_PRIV_FloatAddInt,                                                                             \
                const Int *: MISRA_PRIV_FloatAddConstInt,                                                                  \
                unsigned char: MISRA_PRIV_FloatAddU64,                                                                     \
                Int: MISRA_PRIV_FloatAddValueInt,                                                                          \
                Int *: MISRA_PRIV_FloatAddInt,                                                                             \
                const Int *: MISRA_PRIV_FloatAddConstInt,                                                                  \
                unsigned char: MISRA_PRIV_FloatAddU64,                                                                     \
                unsigned short: MISRA_PRIV_FloatAddU64,                                                                    \
                Float *: FloatSub,                                                                                         \
                const Float *: MISRA_PRIV_FloatSubConstFloat,                                                              \
                Int: MISRA_PRIV_FloatSubValueInt,                                                                          \
                Int *: MISRA_PRIV_FloatSubInt,                                                                             \
                const Int *: MISRA_PRIV_FloatSubConstInt,                                                                  \
                const Float *: MISRA_PRIV_FloatSubConstFloat,                                                              \
                Int: MISRA_PRIV_FloatSubValueInt,                                                                          \
                Int *: MISRA_PRIV_FloatSubInt,                                                                             \
                const Int *: MISRA_PRIV_FloatSubConstInt,                                                                  \
                unsigned char: MISRA_PRIV_FloatSubU64,                                                                     \
                Int: MISRA_PRIV_FloatSubValueInt,                                                                          \
                Int *: MISRA_PRIV_FloatSubInt,                                                                             \
                const Int *: MISRA_PRIV_FloatSubConstInt,                                                                  \
                unsigned char: MISRA_PRIV_FloatSubU64,                                                                     \
                unsigned short: MISRA_PRIV_FloatSubU64,                                                                    \
                Float *: FloatMul,                                                                                         \
                const Float *: MISRA_PRIV_FloatMulConstFloat,                                                              \
                Int: MISRA_PRIV_FloatMulValueInt,                                                                          \
                Int *: MISRA_PRIV_FloatMulInt,                                                                             \
                const Int *: MISRA_PRIV_FloatMulConstInt,                                                                  \
                const Float *: MISRA_PRIV_FloatMulConstFloat,                                                              \
                Int: MISRA_PRIV_FloatMulValueInt,                                                                          \
                Int *: MISRA_PRIV_FloatMulInt,                                                                             \
                const Int *: MISRA_PRIV_FloatMulConstInt,                                                                  \
                unsigned char: MISRA_PRIV_FloatMulU64,                                                                     \
                Int: MISRA_PRIV_FloatMulValueInt,                                                                          \
                Int *: MISRA_PRIV_FloatMulInt,                                                                             \
                const Int *: MISRA_PRIV_FloatMulConstInt,                                                                  \
                unsigned char: MISRA_PRIV_FloatMulU64,                                                                     \
                unsigned short: MISRA_PRIV_FloatMulU64,                                                                    \
                Float *: FloatDiv,                                                                                         \
                const Float *: MISRA_PRIV_FloatDivConstFloat,                                                              \
                Int: MISRA_PRIV_FloatDivValueInt,                                                                          \
                Int *: MISRA_PRIV_FloatDivInt,                                                                             \
                const Int *: MISRA_PRIV_FloatDivConstInt,                                                                  \
                const Float *: MISRA_PRIV_FloatDivConstFloat,                                                              \
                Int: MISRA_PRIV_FloatDivValueInt,                                                                          \
                Int *: MISRA_PRIV_FloatDivInt,                                                                             \
                const Int *: MISRA_PRIV_FloatDivConstInt,                                                                  \
                unsigned char: MISRA_PRIV_FloatDivU64,                                                                     \
                Int: MISRA_PRIV_FloatDivValueInt,                                                                          \
                Int *: MISRA_PRIV_FloatDivInt,                                                                             \
                const Int *: MISRA_PRIV_FloatDivConstInt,                                                                  \
                unsigned char: MISRA_PRIV_FloatDivU64,                                                                     \
                unsigned short: MISRA_PRIV_FloatDivU64,                                                                    \
            _Generic(                                                                                                      \
                (value),                                                                                                   \
                Int: MISRA_PRIV_FloatFromValueInt,                                                                         \
                Int *: MISRA_PRIV_FloatFromInt,                                                                            \
                const Int *: MISRA_PRIV_FloatFromConstInt,                                                                 \
                (value),                                                                                                   \
                Int: MISRA_PRIV_FloatFromValueInt,                                                                         \
                Int *: MISRA_PRIV_FloatFromInt,                                                                            \
                const Int *: MISRA_PRIV_FloatFromConstInt,                                                                 \
                unsigned char: MISRA_PRIV_FloatFromU64,                                                                    \
                Int: MISRA_PRIV_FloatFromValueInt,                                                                         \
                Int *: MISRA_PRIV_FloatFromInt,                                                                            \
                const Int *: MISRA_PRIV_FloatFromConstInt,                                                                 \
                unsigned char: MISRA_PRIV_FloatFromU64,                                                                    \
                unsigned short: MISRA_PRIV_FloatFromU64,                                                                   \
    /// TAGS: Float, Convert, Int, Export
    ///
    bool  FloatToInt(Int *result, Float *value);
    ///
    /// Parse a decimal string into a float.
                Float *: FloatCompare,                                                                                     \
                const Float *: MISRA_PRIV_FloatCompareConstFloat,                                                          \
                Int: MISRA_PRIV_FloatCompareValueInt,                                                                      \
                Int *: MISRA_PRIV_FloatCompareInt,                                                                         \
                const Int *: MISRA_PRIV_FloatCompareConstInt,                                                              \
                const Float *: MISRA_PRIV_FloatCompareConstFloat,                                                          \
                Int: MISRA_PRIV_FloatCompareValueInt,                                                                      \
                Int *: MISRA_PRIV_FloatCompareInt,                                                                         \
                const Int *: MISRA_PRIV_FloatCompareConstInt,                                                              \
                unsigned char: MISRA_PRIV_FloatCompareU64,                                                                 \
                Int: MISRA_PRIV_FloatCompareValueInt,                                                                      \
                Int *: MISRA_PRIV_FloatCompareInt,                                                                         \
                const Int *: MISRA_PRIV_FloatCompareConstInt,                                                              \
                unsigned char: MISRA_PRIV_FloatCompareU64,                                                                 \
                unsigned short: MISRA_PRIV_FloatCompareU64,                                                                \
    
    #include "Type.h"
    #include <Misra/Std/Container/Int/Init.h>
    
    ///
    #define MISRA_STD_CONTAINER_FLOAT_TYPE_H
    
    #include <Misra/Std/Container/Int/Type.h>
    
    ///
    typedef struct {
        bool negative;
        Int  significand;
        i64  exponent;
    } Float;
Last updated on