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)
- In
Io.c:2606:
}
void _write_Int(Str *o, FmtInfo *fmt_info, Int *value) {
if (!o || !fmt_info || !value) {
LOG_FATAL("Invalid arguments");- In
Io.c:2625:
if (!buffer) {
LOG_FATAL("Failed to allocate buffer for Int character formatting");
}- In
Io.c:2776:
}
const char *_read_Int(const char *i, FmtInfo *fmt_info, Int *value) {
if (!i || !value) {
LOG_FATAL("Invalid arguments");- In
Io.c:2782:
if (fmt_info && (fmt_info->flags & FMT_FLAG_CHAR)) {
LOG_ERROR("Character-format reads are not supported for Int");
return i;
}- In
Io.c:2793:
if (!*i) {
LOG_ERROR("Failed to parse Int: empty input");
return i;
}- In
Io.c:2807:
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;
}- In
Io.c:2811:
}
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;
}- In
Io.c:2815:
}
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;
}- In
Io.c:2824:
if (i == digits_start) {
LOG_ERROR("Failed to parse Int");
return start;
}- In
Io.c:2829:
if (*i == '_') {
LOG_ERROR("Int reads do not accept digit separators");
return start;
}- In
Io.c:2834:
Str temp = StrInitFromCstr(start, i - start);
Int parsed = IntFromStrRadix(temp.data, radix);
IntDeinit(value);- In
Float.c:8:
#include <Misra/Std/Container/Float.h>
#include <Misra/Std/Container/Int.h>
#include <Misra/Std/Log.h>- In
Float.c:19:
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);- In
Float.c:70:
}
static Int float_pow10(u64 power) {
Int base = MISRA_PRIV_IntFromU64(10);
Int result = MISRA_PRIV_IntFromU64(1);- In
Float.c:71:
static Int float_pow10(u64 power) {
Int base = MISRA_PRIV_IntFromU64(10);
Int result = MISRA_PRIV_IntFromU64(1);- In
Float.c:72:
static Int float_pow10(u64 power) {
Int base = MISRA_PRIV_IntFromU64(10);
Int result = MISRA_PRIV_IntFromU64(1);
MISRA_PRIV_IntPowU64(&result, &base, power);- In
Float.c:95:
{
u64 places = (u64)(value->exponent - target_exponent);
Int factor = float_pow10(places);
Int scaled = IntInit();- In
Float.c:96:
u64 places = (u64)(value->exponent - target_exponent);
Int factor = float_pow10(places);
Int scaled = IntInit();
IntMul(&scaled, &value->significand, &factor);- In
Float.c:141:
while (MISRA_PRIV_IntModU64(&value->significand, 10) == 0) {
Int quotient = IntInit();
(void)MISRA_PRIV_IntDivU64Rem("ient, &value->significand, 10);- In
Float.c:199:
}
Float MISRA_PRIV_FloatFromInt(Int *value) {
Float result = FloatInit();- In
Float.c:216:
}
bool FloatToInt(Int *result, Float *value) {
Int temp = IntInit();- In
Float.c:217:
bool FloatToInt(Int *result, Float *value) {
Int temp = IntInit();
ValidateInt(result);- In
Float.c:234:
if (value->exponent >= 0) {
Int factor = IntInit();
temp = IntClone(&value->significand);- In
Float.c:248:
{
u64 places = (u64)(-value->exponent);
Int factor = float_pow10(places);
bool ok = IntDivExact(&temp, &value->significand, &factor);- In
Float.c:406:
}
int MISRA_PRIV_FloatCompareInt(Float *lhs, Int *rhs) {
Float rhs_value = MISRA_PRIV_FloatFromInt(rhs);
int cmp = FloatCompare(lhs, &rhs_value);- In
Float.c:498:
}
void MISRA_PRIV_FloatAddInt(Float *result, Float *a, Int *b) {
Float rhs = MISRA_PRIV_FloatFromInt(b);- In
Float.c:545:
}
void MISRA_PRIV_FloatSubInt(Float *result, Float *a, Int *b) {
Float rhs = MISRA_PRIV_FloatFromInt(b);- In
Float.c:595:
}
void MISRA_PRIV_FloatMulInt(Float *result, Float *a, Int *b) {
Float rhs = MISRA_PRIV_FloatFromInt(b);- In
Float.c:632:
void(FloatDiv)(Float *result, Float *a, Float *b, u64 precision) {
Float temp = FloatInit();
Int scale = IntInit();
Int scaled = IntInit();- In
Float.c:633:
Float temp = FloatInit();
Int scale = IntInit();
Int scaled = IntInit();
ValidateFloat(result);- In
Float.c:662:
}
void MISRA_PRIV_FloatDivInt(Float *result, Float *a, Int *b, u64 precision) {
Float rhs = MISRA_PRIV_FloatFromInt(b);- In
Int.c:7:
/// 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>- In
Int.c:14:
typedef struct {
bool negative;
Int magnitude;
} SignedInt;- In
Int.c:19:
#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);- In
Int.c:21:
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) {- In
Int.c:23:
static Int int_from_str_radix_strict(const char *digits, u8 radix);
static Int int_wrap(BitVec bits) {
Int value;- In
Int.c:24:
static Int int_wrap(BitVec bits) {
Int value;
value.bits = bits;- In
Int.c:30:
}
static Int int_init_with_capacity(u64 capacity) {
return int_wrap(BitVecInitWithCapacity(capacity));
}- In
Int.c:34:
}
static u64 int_significant_bits(Int *value) {
ValidateInt(value);- In
Int.c:65:
}
static void int_replace(Int *dst, Int *src) {
IntDeinit(dst);
*dst = *src;- In
Int.c:70:
}
static void int_swap(Int *a, Int *b) {
Int tmp = *a;
*a = *b;- In
Int.c:71:
static void int_swap(Int *a, Int *b) {
Int tmp = *a;
*a = *b;
*b = tmp;- In
Int.c:144:
}
static void sint_mul_unsigned(SignedInt *result, SignedInt *a, Int *b) {
SignedInt temp = sint_init();- In
Int.c:153:
}
static void int_normalize(Int *value) {
ValidateInt(value);
BitVecResize(INT_BITS(value), int_significant_bits(value));- In
Int.c:158:
}
static bool int_is_odd(Int *value) {
ValidateInt(value);
return value->bits.length > 0 && BitVecGet(INT_BITS(value), 0);- In
Int.c:163:
}
static bool int_is_one(Int *value) {
ValidateInt(value);
return IntBitLength(value) == 1 && BitVecGet(INT_BITS(value), 0);- In
Int.c:168:
}
static void int_mul_u64_in_place(Int *value, u64 factor) {
Int lhs = IntClone(value);
Int rhs = MISRA_PRIV_IntFromU64(factor);- In
Int.c:169:
static void int_mul_u64_in_place(Int *value, u64 factor) {
Int lhs = IntClone(value);
Int rhs = MISRA_PRIV_IntFromU64(factor);
Int result = IntInit();- In
Int.c:170:
static void int_mul_u64_in_place(Int *value, u64 factor) {
Int lhs = IntClone(value);
Int rhs = MISRA_PRIV_IntFromU64(factor);
Int result = IntInit();- In
Int.c:171:
Int lhs = IntClone(value);
Int rhs = MISRA_PRIV_IntFromU64(factor);
Int result = IntInit();
IntMul(&result, &lhs, &rhs);- In
Int.c:180:
}
static void int_add_u64_in_place(Int *value, u64 addend) {
Int lhs = IntClone(value);
Int rhs = MISRA_PRIV_IntFromU64(addend);- In
Int.c:181:
static void int_add_u64_in_place(Int *value, u64 addend) {
Int lhs = IntClone(value);
Int rhs = MISRA_PRIV_IntFromU64(addend);
Int result = IntInit();- In
Int.c:182:
static void int_add_u64_in_place(Int *value, u64 addend) {
Int lhs = IntClone(value);
Int rhs = MISRA_PRIV_IntFromU64(addend);
Int result = IntInit();- In
Int.c:183:
Int lhs = IntClone(value);
Int rhs = MISRA_PRIV_IntFromU64(addend);
Int result = IntInit();
IntAdd(&result, &lhs, &rhs);- In
Int.c:223:
}
static Int int_from_str_radix_impl(const char *digits, u64 start, u8 radix) {
Int result = IntInit();
bool saw_digit = false;- In
Int.c:224:
static Int int_from_str_radix_impl(const char *digits, u64 start, u8 radix) {
Int result = IntInit();
bool saw_digit = false;- In
Int.c:238:
digit = int_radix_digit(digits[i]);
if (digit < 0 || digit >= radix) {
LOG_FATAL("Invalid digit for radix in Int conversion");
}- In
Int.c:254:
}
static Int int_from_str_radix_strict(const char *digits, u8 radix) {
Int result = IntInit();
bool saw_digit = false;- In
Int.c:255:
static Int int_from_str_radix_strict(const char *digits, u8 radix) {
Int result = IntInit();
bool saw_digit = false;- In
Int.c:268:
if (digit < 0 || digit >= radix) {
LOG_FATAL("Invalid digit for radix in Int conversion");
}- In
Int.c:284:
}
u64 IntBitLength(Int *value) {
return int_significant_bits(value);
}- In
Int.c:288:
}
u64 IntByteLength(Int *value) {
u64 bits = IntBitLength(value);
return bits == 0 ? 0 : (bits + 7) / 8;- In
Int.c:293:
}
u64 IntLog2(Int *value) {
ValidateInt(value);- In
Int.c:303:
}
u64 IntTrailingZeroCount(Int *value) {
ValidateInt(value);- In
Int.c:315:
}
bool IntIsZero(Int *value) {
return IntBitLength(value) == 0;
}- In
Int.c:319:
}
bool IntIsOne(Int *value) {
return int_is_one(value);
}- In
Int.c:323:
}
bool IntIsEven(Int *value) {
ValidateInt(value);
return !int_is_odd(value);- In
Int.c:328:
}
bool IntIsOdd(Int *value) {
return int_is_odd(value);
}- In
Int.c:332:
}
bool IntFitsU64(Int *value) {
ValidateInt(value);
return IntBitLength(value) <= 64;- In
Int.c:337:
}
bool IntIsPowerOfTwo(Int *value) {
ValidateInt(value);- In
Int.c:343:
}
Int IntClone(Int *value) {
ValidateInt(value);- In
Int.c:346:
ValidateInt(value);
Int clone = int_wrap(BitVecClone(INT_BITS(value)));
int_normalize(&clone);
return clone;- In
Int.c:351:
}
Int MISRA_PRIV_IntFromU64(u64 value) {
u64 bits = int_u64_bits(value);- In
Int.c:361:
}
Int MISRA_PRIV_IntFromI64(i64 value) {
if (value < 0) {
LOG_FATAL("Int cannot represent negative values");- In
Int.c:363:
Int MISRA_PRIV_IntFromI64(i64 value) {
if (value < 0) {
LOG_FATAL("Int cannot represent negative values");
}- In
Int.c:369:
}
u64 IntToU64(Int *value) {
ValidateInt(value);- In
Int.c:373:
if (!IntFitsU64(value)) {
LOG_FATAL("Int value exceeds u64 range");
}- In
Int.c:379:
}
Int IntFromBytesLE(const u8 *bytes, u64 len) {
if (!bytes && len != 0) {
LOG_FATAL("bytes is NULL");- In
Int.c:388:
}
Int result = int_wrap(BitVecFromBytes(bytes, len * 8));
int_normalize(&result);
return result;- In
Int.c:393:
}
u64 IntToBytesLE(Int *value, u8 *bytes, u64 max_len) {
ValidateInt(value);- In
Int.c:429:
}
Int IntFromBytesBE(const u8 *bytes, u64 len) {
if (!bytes && len != 0) {
LOG_FATAL("bytes is NULL");- In
Int.c:434:
}
Int result = IntInit();
for (u64 i = 0; i < len; i++) {- In
Int.c:445:
}
u64 IntToBytesBE(Int *value, u8 *bytes, u64 max_len) {
ValidateInt(value);- In
Int.c:481:
}
Int IntFromStr(const char *decimal) {
if (!decimal) {
LOG_FATAL("decimal is NULL");- In
Int.c:495:
}
Str IntToStr(Int *value) {
return IntToStrRadix(value, 10, false);
}- In
Int.c:499:
}
Int IntFromStrRadix(const char *digits, u8 radix) {
u64 start = 0;- In
Int.c:512:
}
Str IntToStrRadix(Int *value, u8 radix, bool uppercase) {
ValidateInt(value);
int_validate_radix(radix);- In
Int.c:520:
}
Int current = IntClone(value);
Str result = StrInit();- In
Int.c:524:
while (!IntIsZero(¤t)) {
Int quotient = IntInit();
u64 digit = 0;- In
Int.c:544:
}
Int IntFromBinary(const char *binary) {
if (!binary) {
LOG_FATAL("binary is NULL");- In
Int.c:559:
}
Str IntToBinary(Int *value) {
return IntToStrRadix(value, 2, false);
}- In
Int.c:563:
}
Int IntFromOctStr(const char *octal) {
if (!octal) {
LOG_FATAL("octal is NULL");- In
Int.c:578:
}
Str IntToOctStr(Int *value) {
return IntToStrRadix(value, 8, false);
}- In
Int.c:582:
}
Int IntFromHexStr(const char *hex) {
if (!hex) {
LOG_FATAL("hex is NULL");- In
Int.c:590:
}
Str IntToHexStr(Int *value) {
return IntToStrRadix(value, 16, false);
}- In
Int.c:594:
}
int(IntCompare)(Int *lhs, Int *rhs) {
ValidateInt(lhs);
ValidateInt(rhs);- In
Int.c:620:
}
int MISRA_PRIV_IntCompareU64(Int *lhs, u64 rhs) {
ValidateInt(lhs);- In
Int.c:639:
}
int MISRA_PRIV_IntCompareI64(Int *lhs, i64 rhs) {
ValidateInt(lhs);- In
Int.c:649:
}
void IntShiftLeft(Int *value, u64 positions) {
ValidateInt(value);- In
Int.c:674:
}
void IntShiftRight(Int *value, u64 positions) {
ValidateInt(value);- In
Int.c:696:
}
void(IntAdd)(Int *result, Int *a, Int *b) {
ValidateInt(result);
ValidateInt(a);- In
Int.c:704:
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;- In
Int.c:730:
}
void MISRA_PRIV_IntAddU64(Int *result, Int *value, u64 addend) {
ValidateInt(result);
ValidateInt(value);- In
Int.c:734:
ValidateInt(value);
Int temp = IntClone(value);
int_add_u64_in_place(&temp, addend);- In
Int.c:740:
}
void MISRA_PRIV_IntAddI64(Int *result, Int *value, i64 addend) {
u64 magnitude = int_i64_magnitude(addend);- In
Int.c:756:
}
bool(IntSub)(Int *result, Int *a, Int *b) {
ValidateInt(result);
ValidateInt(a);- In
Int.c:767:
u64 a_bits = IntBitLength(a);
u64 b_bits = IntBitLength(b);
Int temp = int_init_with_capacity(a_bits);
bool borrow = false;- In
Int.c:791:
}
bool MISRA_PRIV_IntSubU64(Int *result, Int *value, u64 subtrahend) {
ValidateInt(result);
ValidateInt(value);- In
Int.c:795:
ValidateInt(value);
Int rhs = MISRA_PRIV_IntFromU64(subtrahend);
bool ok = IntSub(result, value, &rhs);- In
Int.c:802:
}
bool MISRA_PRIV_IntSubI64(Int *result, Int *value, i64 subtrahend) {
u64 magnitude = int_i64_magnitude(subtrahend);- In
Int.c:816:
}
void(IntMul)(Int *result, Int *a, Int *b) {
ValidateInt(result);
ValidateInt(a);- In
Int.c:822:
u64 b_bits = IntBitLength(b);
Int acc = IntInit();
if (IntIsZero(a) || IntIsZero(b)) {- In
Int.c:835:
}
Int partial = IntClone(a);
Int next = IntInit();- In
Int.c:836:
Int partial = IntClone(a);
Int next = IntInit();
int_normalize(&partial);- In
Int.c:853:
}
void MISRA_PRIV_IntMulU64(Int *result, Int *value, u64 factor) {
ValidateInt(result);
ValidateInt(value);- In
Int.c:857:
ValidateInt(value);
Int temp = IntClone(value);
int_mul_u64_in_place(&temp, factor);- In
Int.c:863:
}
void MISRA_PRIV_IntMulI64(Int *result, Int *value, i64 factor) {
if (factor < 0) {
LOG_FATAL("Int cannot be multiplied by a negative scalar");- In
Int.c:865:
void MISRA_PRIV_IntMulI64(Int *result, Int *value, i64 factor) {
if (factor < 0) {
LOG_FATAL("Int cannot be multiplied by a negative scalar");
}- In
Int.c:871:
}
void IntSquare(Int *result, Int *value) {
IntMul(result, value, value);
}- In
Int.c:875:
}
void(IntPow)(Int *result, Int *base, Int *exponent) {
ValidateInt(result);
ValidateInt(base);- In
Int.c:881:
if (!IntFitsU64(exponent)) {
LOG_FATAL("Int exponent exceeds u64 range");
}- In
Int.c:887:
}
void MISRA_PRIV_IntPowU64(Int *result, Int *base, u64 exponent) {
ValidateInt(result);
ValidateInt(base);- In
Int.c:891:
ValidateInt(base);
Int acc = MISRA_PRIV_IntFromU64(1);
Int current = IntClone(base);- In
Int.c:892:
Int acc = MISRA_PRIV_IntFromU64(1);
Int current = IntClone(base);
while (exponent > 0) {- In
Int.c:896:
while (exponent > 0) {
if (exponent & 1u) {
Int next = IntInit();
IntMul(&next, &acc, ¤t);- In
Int.c:905:
exponent >>= 1u;
if (exponent > 0) {
Int next = IntInit();
IntSquare(&next, ¤t);- In
Int.c:917:
}
void MISRA_PRIV_IntPowI64(Int *result, Int *base, i64 exponent) {
if (exponent < 0) {
LOG_FATAL("Int exponent cannot be negative");- In
Int.c:919:
void MISRA_PRIV_IntPowI64(Int *result, Int *base, i64 exponent) {
if (exponent < 0) {
LOG_FATAL("Int exponent cannot be negative");
}- In
Int.c:925:
}
void(IntDivMod)(Int *quotient, Int *remainder, Int *dividend, Int *divisor) {
ValidateInt(quotient);
ValidateInt(remainder);- In
Int.c:938:
}
Int normalized_dividend = IntClone(dividend);
Int normalized_divisor = IntClone(divisor);
Int q = IntInit();- In
Int.c:939:
Int normalized_dividend = IntClone(dividend);
Int normalized_divisor = IntClone(divisor);
Int q = IntInit();
Int r = IntClone(&normalized_dividend);- In
Int.c:940:
Int normalized_dividend = IntClone(dividend);
Int normalized_divisor = IntClone(divisor);
Int q = IntInit();
Int r = IntClone(&normalized_dividend);- In
Int.c:941:
Int normalized_divisor = IntClone(divisor);
Int q = IntInit();
Int r = IntClone(&normalized_dividend);
if (IntCompare(&normalized_dividend, &normalized_divisor) >= 0) {- In
Int.c:951:
for (u64 shift = dividend_bits - divisor_bits + 1; shift > 0; shift--) {
u64 bit = shift - 1;
Int shifted = IntClone(&normalized_divisor);
IntShiftLeft(&shifted, bit);- In
Int.c:956:
if (IntGE(&r, &shifted)) {
Int next = IntInit();
(void)IntSub(&next, &r, &shifted);- In
Int.c:984:
}
void(IntDiv)(Int *result, Int *dividend, Int *divisor) {
Int quotient = IntInit();
Int remainder = IntInit();- In
Int.c:985:
void(IntDiv)(Int *result, Int *dividend, Int *divisor) {
Int quotient = IntInit();
Int remainder = IntInit();- In
Int.c:986:
void(IntDiv)(Int *result, Int *dividend, Int *divisor) {
Int quotient = IntInit();
Int remainder = IntInit();
IntDivMod("ient, &remainder, dividend, divisor);- In
Int.c:993:
}
bool(IntDivExact)(Int *result, Int *dividend, Int *divisor) {
ValidateInt(result);
ValidateInt(dividend);- In
Int.c:1002:
}
Int quotient = IntInit();
Int remainder = IntInit();- In
Int.c:1003:
Int quotient = IntInit();
Int remainder = IntInit();
IntDivMod("ient, &remainder, dividend, divisor);- In
Int.c:1017:
}
void MISRA_PRIV_IntDivU64(Int *result, Int *dividend, u64 divisor) {
Int divisor_value = MISRA_PRIV_IntFromU64(divisor);- In
Int.c:1018:
void MISRA_PRIV_IntDivU64(Int *result, Int *dividend, u64 divisor) {
Int divisor_value = MISRA_PRIV_IntFromU64(divisor);
IntDiv(result, dividend, &divisor_value);- In
Int.c:1024:
}
void MISRA_PRIV_IntDivI64(Int *result, Int *dividend, i64 divisor) {
Int divisor_value = MISRA_PRIV_IntFromI64(divisor);- In
Int.c:1025:
void MISRA_PRIV_IntDivI64(Int *result, Int *dividend, i64 divisor) {
Int divisor_value = MISRA_PRIV_IntFromI64(divisor);
IntDiv(result, dividend, &divisor_value);- In
Int.c:1031:
}
bool MISRA_PRIV_IntDivExactU64(Int *result, Int *dividend, u64 divisor) {
Int divisor_value = MISRA_PRIV_IntFromU64(divisor);
bool ok = IntDivExact(result, dividend, &divisor_value);- In
Int.c:1032:
bool MISRA_PRIV_IntDivExactU64(Int *result, Int *dividend, u64 divisor) {
Int divisor_value = MISRA_PRIV_IntFromU64(divisor);
bool ok = IntDivExact(result, dividend, &divisor_value);- In
Int.c:1039:
}
bool MISRA_PRIV_IntDivExactI64(Int *result, Int *dividend, i64 divisor) {
Int divisor_value = MISRA_PRIV_IntFromI64(divisor);
bool ok = IntDivExact(result, dividend, &divisor_value);- In
Int.c:1040:
bool MISRA_PRIV_IntDivExactI64(Int *result, Int *dividend, i64 divisor) {
Int divisor_value = MISRA_PRIV_IntFromI64(divisor);
bool ok = IntDivExact(result, dividend, &divisor_value);- In
Int.c:1047:
}
void MISRA_PRIV_IntDivModU64(Int *quotient, Int *remainder, Int *dividend, u64 divisor) {
Int divisor_value = MISRA_PRIV_IntFromU64(divisor);- In
Int.c:1048:
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);- In
Int.c:1054:
}
void MISRA_PRIV_IntDivModI64(Int *quotient, Int *remainder, Int *dividend, i64 divisor) {
Int divisor_value = MISRA_PRIV_IntFromI64(divisor);- In
Int.c:1055:
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);- In
Int.c:1061:
}
u64 MISRA_PRIV_IntDivU64Rem(Int *quotient, Int *dividend, u64 divisor) {
ValidateInt(quotient);
ValidateInt(dividend);- In
Int.c:1069:
}
Int divisor_value = MISRA_PRIV_IntFromU64(divisor);
Int remainder = IntInit();
u64 rem = 0;- In
Int.c:1070:
Int divisor_value = MISRA_PRIV_IntFromU64(divisor);
Int remainder = IntInit();
u64 rem = 0;- In
Int.c:1081:
}
void(IntMod)(Int *result, Int *dividend, Int *divisor) {
Int quotient = IntInit();
Int remainder = IntInit();- In
Int.c:1082:
void(IntMod)(Int *result, Int *dividend, Int *divisor) {
Int quotient = IntInit();
Int remainder = IntInit();- In
Int.c:1083:
void(IntMod)(Int *result, Int *dividend, Int *divisor) {
Int quotient = IntInit();
Int remainder = IntInit();
IntDivMod("ient, &remainder, dividend, divisor);- In
Int.c:1090:
}
void MISRA_PRIV_IntModU64Into(Int *result, Int *dividend, u64 divisor) {
Int quotient = IntInit();- In
Int.c:1091:
void MISRA_PRIV_IntModU64Into(Int *result, Int *dividend, u64 divisor) {
Int quotient = IntInit();
MISRA_PRIV_IntDivModU64("ient, result, dividend, divisor);- In
Int.c:1097:
}
void MISRA_PRIV_IntModI64Into(Int *result, Int *dividend, i64 divisor) {
Int quotient = IntInit();- In
Int.c:1098:
void MISRA_PRIV_IntModI64Into(Int *result, Int *dividend, i64 divisor) {
Int quotient = IntInit();
MISRA_PRIV_IntDivModI64("ient, result, dividend, divisor);- In
Int.c:1104:
}
u64 MISRA_PRIV_IntModU64(Int *value, u64 modulus) {
ValidateInt(value);- In
Int.c:1111:
}
Int quotient = IntInit();
u64 rem = MISRA_PRIV_IntDivU64Rem("ient, value, modulus);- In
Int.c:1118:
}
void IntGCD(Int *result, Int *a, Int *b) {
ValidateInt(result);
ValidateInt(a);- In
Int.c:1123:
ValidateInt(b);
Int x = IntClone(a);
Int y = IntClone(b);- In
Int.c:1124:
Int x = IntClone(a);
Int y = IntClone(b);
while (!IntIsZero(&y)) {- In
Int.c:1127:
while (!IntIsZero(&y)) {
Int r = IntInit();
IntMod(&r, &x, &y);- In
Int.c:1139:
}
void IntLCM(Int *result, Int *a, Int *b) {
ValidateInt(result);
ValidateInt(a);- In
Int.c:1145:
if (IntIsZero(a) || IntIsZero(b)) {
Int zero = IntInit();
int_replace(result, &zero);
return;- In
Int.c:1150:
}
Int gcd = IntInit();
Int quotient = IntInit();
Int lcm = IntInit();- In
Int.c:1151:
Int gcd = IntInit();
Int quotient = IntInit();
Int lcm = IntInit();- In
Int.c:1152:
Int gcd = IntInit();
Int quotient = IntInit();
Int lcm = IntInit();
IntGCD(&gcd, a, b);- In
Int.c:1163:
}
void IntRootRem(Int *root, Int *remainder, Int *value, u64 degree) {
ValidateInt(root);
ValidateInt(remainder);- In
Int.c:1176:
if (IntIsZero(value)) {
Int zero_root = IntInit();
Int zero_rem = IntInit();- In
Int.c:1177:
if (IntIsZero(value)) {
Int zero_root = IntInit();
Int zero_rem = IntInit();
int_replace(root, &zero_root);- In
Int.c:1184:
}
if (degree == 1) {
Int exact_root = IntClone(value);
Int zero_rem = IntInit();- In
Int.c:1185:
if (degree == 1) {
Int exact_root = IntClone(value);
Int zero_rem = IntInit();
int_replace(root, &exact_root);- In
Int.c:1194:
u64 bits = IntBitLength(value);
u64 high_shift = bits / degree;
Int low = IntInit();
Int high = MISRA_PRIV_IntFromU64(1);
Int best = IntInit();- In
Int.c:1195:
u64 high_shift = bits / degree;
Int low = IntInit();
Int high = MISRA_PRIV_IntFromU64(1);
Int best = IntInit();
Int one = MISRA_PRIV_IntFromU64(1);- In
Int.c:1196:
Int low = IntInit();
Int high = MISRA_PRIV_IntFromU64(1);
Int best = IntInit();
Int one = MISRA_PRIV_IntFromU64(1);- In
Int.c:1197:
Int high = MISRA_PRIV_IntFromU64(1);
Int best = IntInit();
Int one = MISRA_PRIV_IntFromU64(1);
if ((bits % degree) != 0) {- In
Int.c:1209:
while (IntLE(&low, &high)) {
Int sum = IntInit();
Int mid = IntInit();
Int mid_pow = IntInit();- In
Int.c:1210:
while (IntLE(&low, &high)) {
Int sum = IntInit();
Int mid = IntInit();
Int mid_pow = IntInit();
int cmp = 0;- In
Int.c:1211:
Int sum = IntInit();
Int mid = IntInit();
Int mid_pow = IntInit();
int cmp = 0;- In
Int.c:1222:
if (cmp <= 0) {
Int next = IntInit();
IntDeinit(&best);- In
Int.c:1230:
low = next;
} else {
Int next = IntInit();
if (IntEQ(&mid, &one) || IntIsZero(&mid)) {- In
Int.c:1247:
{
Int power = IntInit();
Int rem = IntInit();- In
Int.c:1248:
{
Int power = IntInit();
Int rem = IntInit();
MISRA_PRIV_IntPowU64(&power, &best, degree);- In
Int.c:1263:
}
void IntRoot(Int *result, Int *value, u64 degree) {
Int root = IntInit();
Int remainder = IntInit();- In
Int.c:1264:
void IntRoot(Int *result, Int *value, u64 degree) {
Int root = IntInit();
Int remainder = IntInit();- In
Int.c:1265:
void IntRoot(Int *result, Int *value, u64 degree) {
Int root = IntInit();
Int remainder = IntInit();
IntRootRem(&root, &remainder, value, degree);- In
Int.c:1272:
}
void IntSqrtRem(Int *root, Int *remainder, Int *value) {
IntRootRem(root, remainder, value, 2);
}- In
Int.c:1276:
}
void IntSqrt(Int *result, Int *value) {
IntRoot(result, value, 2);
}- In
Int.c:1280:
}
bool IntIsPerfectSquare(Int *value) {
ValidateInt(value);- In
Int.c:1283:
ValidateInt(value);
Int root = IntInit();
Int remainder = IntInit();
bool result = false;- In
Int.c:1284:
Int root = IntInit();
Int remainder = IntInit();
bool result = false;- In
Int.c:1295:
}
bool IntIsPerfectPower(Int *value) {
ValidateInt(value);- In
Int.c:1305:
for (u64 degree = 2; degree <= max_degree; degree++) {
Int root = IntInit();
Int remainder = IntInit();
bool exact = false;- In
Int.c:1306:
for (u64 degree = 2; degree <= max_degree; degree++) {
Int root = IntInit();
Int remainder = IntInit();
bool exact = false;- In
Int.c:1323:
}
int IntJacobi(Int *a, Int *n) {
ValidateInt(a);
ValidateInt(n);- In
Int.c:1331:
}
Int aa = IntInit();
Int nn = IntClone(n);
int result = 1;- In
Int.c:1332:
Int aa = IntInit();
Int nn = IntClone(n);
int result = 1;- In
Int.c:1367:
}
void IntModAdd(Int *result, Int *a, Int *b, Int *modulus) {
ValidateInt(result);
ValidateInt(a);- In
Int.c:1377:
}
Int ar = IntInit();
Int br = IntInit();
Int sum = IntInit();- In
Int.c:1378:
Int ar = IntInit();
Int br = IntInit();
Int sum = IntInit();- In
Int.c:1379:
Int ar = IntInit();
Int br = IntInit();
Int sum = IntInit();
IntMod(&ar, a, modulus);- In
Int.c:1391:
}
void IntModSub(Int *result, Int *a, Int *b, Int *modulus) {
ValidateInt(result);
ValidateInt(a);- In
Int.c:1401:
}
Int ar = IntInit();
Int br = IntInit();- In
Int.c:1402:
Int ar = IntInit();
Int br = IntInit();
IntMod(&ar, a, modulus);- In
Int.c:1410:
(void)IntSub(result, &ar, &br);
} else {
Int diff = IntInit();
(void)IntSub(&diff, &br, &ar);- In
Int.c:1414:
(void)IntSub(&diff, &br, &ar);
if (IntIsZero(&diff)) {
Int zero = IntInit();
int_replace(result, &zero);
} else {- In
Int.c:1427:
}
void IntModMul(Int *result, Int *a, Int *b, Int *modulus) {
ValidateInt(result);
ValidateInt(a);- In
Int.c:1437:
}
Int ar = IntInit();
Int br = IntInit();
Int prod = IntInit();- In
Int.c:1438:
Int ar = IntInit();
Int br = IntInit();
Int prod = IntInit();- In
Int.c:1439:
Int ar = IntInit();
Int br = IntInit();
Int prod = IntInit();
IntMod(&ar, a, modulus);- In
Int.c:1451:
}
bool IntModDiv(Int *result, Int *a, Int *b, Int *modulus) {
ValidateInt(result);
ValidateInt(a);- In
Int.c:1461:
}
Int inverse = IntInit();
Int value = IntInit();
bool ok = false;- In
Int.c:1462:
Int inverse = IntInit();
Int value = IntInit();
bool ok = false;- In
Int.c:1479:
}
void IntSquareMod(Int *result, Int *value, Int *modulus) {
IntModMul(result, value, value, modulus);
}- In
Int.c:1483:
}
void MISRA_PRIV_IntPowU64Mod(Int *result, Int *base, u64 exponent, Int *modulus) {
ValidateInt(result);
ValidateInt(base);- In
Int.c:1492:
}
Int acc = MISRA_PRIV_IntFromU64(1);
Int base_mod = IntInit();- In
Int.c:1493:
Int acc = MISRA_PRIV_IntFromU64(1);
Int base_mod = IntInit();
IntMod(&acc, &acc, modulus);- In
Int.c:1500:
while (exponent > 0) {
if (exponent & 1u) {
Int next = IntInit();
IntModMul(&next, &acc, &base_mod, modulus);- In
Int.c:1509:
exponent >>= 1u;
if (exponent > 0) {
Int next = IntInit();
IntModMul(&next, &base_mod, &base_mod, modulus);- In
Int.c:1521:
}
void(IntPowMod)(Int *result, Int *base, Int *exponent, Int *modulus) {
ValidateInt(result);
ValidateInt(base);- In
Int.c:1531:
}
Int acc = MISRA_PRIV_IntFromU64(1);
Int base_mod = IntInit();
Int exp = IntClone(exponent);- In
Int.c:1532:
Int acc = MISRA_PRIV_IntFromU64(1);
Int base_mod = IntInit();
Int exp = IntClone(exponent);- In
Int.c:1533:
Int acc = MISRA_PRIV_IntFromU64(1);
Int base_mod = IntInit();
Int exp = IntClone(exponent);
IntMod(&acc, &acc, modulus);- In
Int.c:1540:
while (!IntIsZero(&exp)) {
if (int_is_odd(&exp)) {
Int next = IntInit();
IntModMul(&next, &acc, &base_mod, modulus);- In
Int.c:1549:
IntShiftRight(&exp, 1);
if (!IntIsZero(&exp)) {
Int next = IntInit();
IntModMul(&next, &base_mod, &base_mod, modulus);- In
Int.c:1562:
}
void MISRA_PRIV_IntPowI64Mod(Int *result, Int *base, i64 exponent, Int *modulus) {
if (exponent < 0) {
LOG_FATAL("Int exponent cannot be negative");- In
Int.c:1564:
void MISRA_PRIV_IntPowI64Mod(Int *result, Int *base, i64 exponent, Int *modulus) {
if (exponent < 0) {
LOG_FATAL("Int exponent cannot be negative");
}- In
Int.c:1570:
}
bool IntModInv(Int *result, Int *value, Int *modulus) {
ValidateInt(result);
ValidateInt(value);- In
Int.c:1579:
}
Int reduced = IntInit();
SignedInt t = sint_init();
SignedInt new_t = sint_from_u64(1);- In
Int.c:1582:
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);- In
Int.c:1583:
SignedInt new_t = sint_from_u64(1);
Int r = IntClone(modulus);
Int new_r = IntInit();
Int one = MISRA_PRIV_IntFromU64(1);
bool ok = false;- In
Int.c:1584:
Int r = IntClone(modulus);
Int new_r = IntInit();
Int one = MISRA_PRIV_IntFromU64(1);
bool ok = false;- In
Int.c:1591:
while (!IntIsZero(&new_r)) {
Int q = IntInit();
Int rem = IntInit();
SignedInt q_new_t = sint_init();- In
Int.c:1592:
while (!IntIsZero(&new_r)) {
Int q = IntInit();
Int rem = IntInit();
SignedInt q_new_t = sint_init();
SignedInt next_t = sint_init();- In
Int.c:1595:
SignedInt q_new_t = sint_init();
SignedInt next_t = sint_init();
Int next_r = IntInit();
IntDivMod(&q, &rem, &r, &new_r);- In
Int.c:1617:
if (IntEQ(&r, &one)) {
Int positive = IntInit();
Int mag_mod = IntInit();- In
Int.c:1618:
if (IntEQ(&r, &one)) {
Int positive = IntInit();
Int mag_mod = IntInit();
IntMod(&mag_mod, &t.magnitude, modulus);- In
Int.c:1641:
}
bool IntModSqrt(Int *result, Int *value, Int *modulus) {
ValidateInt(result);
ValidateInt(value);- In
Int.c:1650:
}
Int a = IntInit();
bool ok = false;- In
Int.c:1656:
if (IntIsZero(&a)) {
Int zero = IntInit();
int_replace(result, &zero);
IntDeinit(&a);- In
Int.c:1674:
}
if (MISRA_PRIV_IntModU64(modulus, 4) == 3) {
Int exponent = IntClone(modulus);
Int root = IntInit();- In
Int.c:1675:
if (MISRA_PRIV_IntModU64(modulus, 4) == 3) {
Int exponent = IntClone(modulus);
Int root = IntInit();
MISRA_PRIV_IntAddU64(&exponent, &exponent, 1);- In
Int.c:1688:
{
Int q = IntClone(modulus);
Int z = MISRA_PRIV_IntFromU64(2);
Int c = IntInit();- In
Int.c:1689:
{
Int q = IntClone(modulus);
Int z = MISRA_PRIV_IntFromU64(2);
Int c = IntInit();
Int t = IntInit();- In
Int.c:1690:
Int q = IntClone(modulus);
Int z = MISRA_PRIV_IntFromU64(2);
Int c = IntInit();
Int t = IntInit();
Int r = IntInit();- In
Int.c:1691:
Int z = MISRA_PRIV_IntFromU64(2);
Int c = IntInit();
Int t = IntInit();
Int r = IntInit();
Int exponent = IntInit();- In
Int.c:1692:
Int c = IntInit();
Int t = IntInit();
Int r = IntInit();
Int exponent = IntInit();
u64 m = 0;- In
Int.c:1693:
Int t = IntInit();
Int r = IntInit();
Int exponent = IntInit();
u64 m = 0;- In
Int.c:1715:
while (MISRA_PRIV_IntCompareU64(&t, 1) != 0) {
Int t_power = IntClone(&t);
u64 i = 0;- In
Int.c:1719:
for (i = 1; i < m; i++) {
Int next = IntInit();
IntSquareMod(&next, &t_power, modulus);- In
Int.c:1736:
{
Int b = IntClone(&c);
Int b_sq = IntInit();
Int next = IntInit();- In
Int.c:1737:
{
Int b = IntClone(&c);
Int b_sq = IntInit();
Int next = IntInit();- In
Int.c:1738:
Int b = IntClone(&c);
Int b_sq = IntInit();
Int next = IntInit();
for (u64 j = 0; j + i + 1 < m; j++) {- In
Int.c:1741:
for (u64 j = 0; j + i + 1 < m; j++) {
Int square = IntInit();
IntSquareMod(&square, &b, modulus);- In
Int.c:1785:
}
bool IntIsProbablePrime(Int *value) {
static const u64 bases[] = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37};- In
Int.c:1810:
{
Int d = IntClone(value);
Int n_minus_one = IntInit();
u64 s = 0;- In
Int.c:1811:
{
Int d = IntClone(value);
Int n_minus_one = IntInit();
u64 s = 0;
bool probable = true;- In
Int.c:1824:
for (u64 i = 0; i < (u64)(sizeof(bases) / sizeof(bases[0])); i++) {
Int base = MISRA_PRIV_IntFromU64(bases[i]);
Int x = IntInit();- In
Int.c:1825:
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) {- In
Int.c:1844:
for (u64 r = 1; r < s; r++) {
Int next = IntInit();
IntSquareMod(&next, &x, value);- In
Int.c:1874:
}
void IntNextPrime(Int *result, Int *value) {
ValidateInt(result);
ValidateInt(value);- In
Int.c:1879:
if (MISRA_PRIV_IntCompareU64(value, 1) <= 0) {
Int two = MISRA_PRIV_IntFromU64(2);
int_replace(result, &two);
return;- In
Int.c:1884:
}
Int candidate = IntClone(value);
MISRA_PRIV_IntAddU64(&candidate, &candidate, 1);- In
Int.c:1888:
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);- In
Float.Math.c:2:
#include <Misra/Std/Container/Float.h>
#include <Misra/Std/Container/Int.h>
#include <Misra/Std/Log.h>
#include <string.h>- In
Float.Math.c:90:
Float a = FloatFromStr("1.25");
Float b = FloatFromStr("0.75");
Int whole = IntFrom(2);
Float result_value = FloatInit();
Str text = StrInit();- In
Float.Math.c:176:
Float a = FloatFromStr("5.5");
Float b = FloatFromStr("0.5");
Int whole = IntFrom(2);
Float result_value = FloatInit();
Str text = StrInit();- In
Float.Math.c:257:
Float a = FloatFromStr("1.5");
Float b = FloatFromStr("2");
Int whole = IntFrom(2);
Float result_value = FloatInit();
Str text = StrInit();- In
Float.Math.c:338:
Float a = FloatFromStr("7.5");
Float b = FloatFromStr("2.5");
Int whole = IntFrom(3);
Float result_value = FloatInit();
Str text = StrInit();- In
Int.Convert.c:1:
#include <Misra/Std/Container/Int.h>
#include <Misra/Std/Log.h>
#include <Misra/Types.h>- In
Int.Convert.c:39:
WriteFmt("Testing IntFrom with unsigned integer\n");
Int value = IntFrom(13);
Str text = IntToBinary(&value);- In
Int.Convert.c:52:
bool test_int_bytes_le_round_trip(void) {
WriteFmt("Testing Int little-endian byte conversion\n");
u8 bytes[] = {0x34, 0x12, 0xEF, 0xCD};- In
Int.Convert.c:56:
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);- In
Int.Convert.c:70:
bool test_int_bytes_be_round_trip(void) {
WriteFmt("Testing Int big-endian byte conversion\n");
u8 bytes[] = {0x12, 0x34, 0x56, 0x78};- In
Int.Convert.c:74:
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);- In
Int.Convert.c:88:
bool test_int_binary_round_trip(void) {
WriteFmt("Testing Int binary round trip\n");
Int value = IntFromBinary("001011");- In
Int.Convert.c:90:
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");
}- In
Int.Compare.c:1:
#include <Misra/Std/Container/Int.h>
#include <Misra/Std/Log.h>
#include <Misra/Types.h>- In
Int.Compare.c:14:
WriteFmt("Testing IntCompare\n");
Int a = IntFrom(41);
Int b = IntFrom(42);
Int c = IntFromBinary("000101010");- In
Int.Compare.c:15:
Int a = IntFrom(41);
Int b = IntFrom(42);
Int c = IntFromBinary("000101010");- In
Int.Compare.c:16:
Int a = IntFrom(41);
Int b = IntFrom(42);
Int c = IntFromBinary("000101010");
bool result = IntCompare(&a, &b) < 0;- In
Int.Compare.c:29:
bool test_int_compare_wrappers(void) {
WriteFmt("Testing Int compare wrappers\n");
Int a = IntFrom(41);- In
Int.Compare.c:31:
WriteFmt("Testing Int compare wrappers\n");
Int a = IntFrom(41);
Int b = IntFrom(42);
Int c = IntFromBinary("000101010");- In
Int.Compare.c:32:
Int a = IntFrom(41);
Int b = IntFrom(42);
Int c = IntFromBinary("000101010");- In
Int.Compare.c:33:
Int a = IntFrom(41);
Int b = IntFrom(42);
Int c = IntFromBinary("000101010");
bool result = IntLT(&a, &b);- In
Int.Compare.c:53:
WriteFmt("Testing IntCompare generic dispatch\n");
Int value = IntFrom(42);
Int same = IntFromBinary("00101010");
Int big = IntFrom(1);- In
Int.Compare.c:54:
Int value = IntFrom(42);
Int same = IntFromBinary("00101010");
Int big = IntFrom(1);- In
Int.Compare.c:55:
Int value = IntFrom(42);
Int same = IntFromBinary("00101010");
Int big = IntFrom(1);
IntShiftLeft(&big, 80);- In
Int.Compare.c:78:
int main(void) {
WriteFmt("[INFO] Starting Int.Compare tests\n\n");
TestFunction tests[] = {- In
Int.Compare.c:87:
int total_tests = sizeof(tests) / sizeof(tests[0]);
return run_test_suite(tests, total_tests, NULL, 0, "Int.Compare");
}- In
Io.Read.c:887:
bool test_int_reading(void) {
WriteFmt("Testing Int reading\n");
const char *z = NULL;- In
Io.Read.c:892:
bool success = true;
Int dec = IntInit();
Int hex = IntInit();
Int bin = IntInit();- In
Io.Read.c:893:
Int dec = IntInit();
Int hex = IntInit();
Int bin = IntInit();
Int oct = IntInit();- In
Io.Read.c:894:
Int dec = IntInit();
Int hex = IntInit();
Int bin = IntInit();
Int oct = IntInit();- In
Io.Read.c:895:
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);- In
Io.Write.c:620:
bool test_int_formatting(void) {
WriteFmt("Testing Int formatting\n");
Str output = StrInit();- In
Io.Write.c:625:
bool success = true;
Int big_dec = IntFromStr("123456789012345678901234567890");
Int hex_val = IntFromHexStr("deadbeefcafebabe1234");
Int bin_val = IntFromBinary("10100011");- In
Io.Write.c:626:
Int big_dec = IntFromStr("123456789012345678901234567890");
Int hex_val = IntFromHexStr("deadbeefcafebabe1234");
Int bin_val = IntFromBinary("10100011");
Int oct_val = IntFrom(493);- In
Io.Write.c:627:
Int big_dec = IntFromStr("123456789012345678901234567890");
Int hex_val = IntFromHexStr("deadbeefcafebabe1234");
Int bin_val = IntFromBinary("10100011");
Int oct_val = IntFrom(493);- In
Io.Write.c:628:
Int hex_val = IntFromHexStr("deadbeefcafebabe1234");
Int bin_val = IntFromBinary("10100011");
Int oct_val = IntFrom(493);
StrWriteFmt(&output, "{}", big_dec);- In
Int.Access.c:1:
#include <Misra/Std/Container/Int.h>
#include <Misra/Std/Log.h>
#include <Misra/Types.h>- In
Int.Access.c:21:
WriteFmt("Testing IntBitLength\n");
Int value = IntFromBinary("00101000");
bool result = IntBitLength(&value) == 6;- In
Int.Access.c:32:
WriteFmt("Testing IntByteLength\n");
Int value = IntFromBinary("0001001000110100");
bool result = IntByteLength(&value) == 2;- In
Int.Access.c:43:
WriteFmt("Testing IntIsZero\n");
Int zero = IntInit();
Int non_zero = IntFrom(1);- In
Int.Access.c:44:
Int zero = IntInit();
Int non_zero = IntFrom(1);
bool result = IntIsZero(&zero);- In
Int.Access.c:57:
WriteFmt("Testing IntIsOne\n");
Int one = IntFrom(1);
Int two = IntFrom(2);- In
Int.Access.c:58:
Int one = IntFrom(1);
Int two = IntFrom(2);
bool result = IntIsOne(&one);- In
Int.Access.c:69:
bool test_int_parity(void) {
WriteFmt("Testing Int parity helpers\n");
Int even = IntFrom(42);- In
Int.Access.c:71:
WriteFmt("Testing Int parity helpers\n");
Int even = IntFrom(42);
Int odd = IntFrom(43);- In
Int.Access.c:72:
Int even = IntFrom(42);
Int odd = IntFrom(43);
bool result = IntIsEven(&even);- In
Int.Access.c:87:
WriteFmt("Testing IntFitsU64\n");
Int small = IntFrom(UINT64_MAX);
Int big = IntFrom(1);- In
Int.Access.c:88:
Int small = IntFrom(UINT64_MAX);
Int big = IntFrom(1);
IntShiftLeft(&big, 64);- In
Int.Access.c:103:
WriteFmt("Testing IntLog2\n");
Int value = IntFrom(1025);
bool result = IntLog2(&value) == 10;- In
Int.Access.c:114:
WriteFmt("Testing IntTrailingZeroCount\n");
Int value = IntFromBinary("1010000");
Int zero = IntInit();- In
Int.Access.c:115:
Int value = IntFromBinary("1010000");
Int zero = IntInit();
bool result = IntTrailingZeroCount(&value) == 4;- In
Int.Access.c:128:
WriteFmt("Testing IntIsPowerOfTwo\n");
Int one = IntFrom(1);
Int power = IntFrom(1);
Int other = IntFrom(24);- In
Int.Access.c:129:
Int one = IntFrom(1);
Int power = IntFrom(1);
Int other = IntFrom(24);
Int zero = IntInit();- In
Int.Access.c:130:
Int one = IntFrom(1);
Int power = IntFrom(1);
Int other = IntFrom(24);
Int zero = IntInit();- In
Int.Access.c:131:
Int power = IntFrom(1);
Int other = IntFrom(24);
Int zero = IntInit();
IntShiftLeft(&power, 20);- In
Int.Access.c:150:
WriteFmt("Testing IntLog2 zero handling\n");
Int value = IntInit();
IntLog2(&value);- In
Int.Access.c:157:
int main(void) {
WriteFmt("[INFO] Starting Int.Access tests\n\n");
TestFunction tests[] = {- In
Int.Access.c:178:
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);- In
Int.Math.c:1:
#include <Misra/Std/Container/Int.h>
#include <Misra/Std/Log.h>
#include <Misra/Types.h>- In
Int.Math.c:64:
WriteFmt("Testing IntShiftLeft\n");
Int value = IntFrom(3);
IntShiftLeft(&value, 4);- In
Int.Math.c:78:
WriteFmt("Testing IntShiftRight\n");
Int value = IntFromBinary("110000");
IntShiftRight(&value, 4);- In
Int.Math.c:92:
WriteFmt("Testing IntAdd\n");
Int a = IntFrom(255);
Int b = IntFrom(1);
Int result_value = IntInit();- In
Int.Math.c:93:
Int a = IntFrom(255);
Int b = IntFrom(1);
Int result_value = IntInit();
Str text = StrInit();- In
Int.Math.c:94:
Int a = IntFrom(255);
Int b = IntFrom(1);
Int result_value = IntInit();
Str text = StrInit();- In
Int.Math.c:113:
WriteFmt("Testing IntAdd generic dispatch\n");
Int base = IntFrom(40);
Int rhs = IntFrom(2);
Int result_value = IntInit();- In
Int.Math.c:114:
Int base = IntFrom(40);
Int rhs = IntFrom(2);
Int result_value = IntInit();
Int huge = IntFromStr("123456789012345678901234567890");- In
Int.Math.c:115:
Int base = IntFrom(40);
Int rhs = IntFrom(2);
Int result_value = IntInit();
Int huge = IntFromStr("123456789012345678901234567890");
Str text = StrInit();- In
Int.Math.c:116:
Int rhs = IntFrom(2);
Int result_value = IntInit();
Int huge = IntFromStr("123456789012345678901234567890");
Str text = StrInit();- In
Int.Math.c:143:
WriteFmt("Testing IntSub\n");
Int a = IntFrom(256);
Int b = IntFrom(1);
Int result_value = IntInit();- In
Int.Math.c:144:
Int a = IntFrom(256);
Int b = IntFrom(1);
Int result_value = IntInit();- In
Int.Math.c:145:
Int a = IntFrom(256);
Int b = IntFrom(1);
Int result_value = IntInit();
bool result = IntSub(&result_value, &a, &b);- In
Int.Math.c:159:
WriteFmt("Testing IntSub generic dispatch\n");
Int base = IntFrom(40);
Int rhs = IntFrom(2);
Int result_value = IntInit();- In
Int.Math.c:160:
Int base = IntFrom(40);
Int rhs = IntFrom(2);
Int result_value = IntInit();
Int preserved = IntFrom(99);- In
Int.Math.c:161:
Int base = IntFrom(40);
Int rhs = IntFrom(2);
Int result_value = IntInit();
Int preserved = IntFrom(99);
Int huge = IntFromStr("12345678901234567890");- In
Int.Math.c:162:
Int rhs = IntFrom(2);
Int result_value = IntInit();
Int preserved = IntFrom(99);
Int huge = IntFromStr("12345678901234567890");
Str text = StrInit();- In
Int.Math.c:163:
Int result_value = IntInit();
Int preserved = IntFrom(99);
Int huge = IntFromStr("12345678901234567890");
Str text = StrInit();- In
Int.Math.c:194:
WriteFmt("Testing IntSub underflow handling\n");
Int a = IntFrom(3);
Int b = IntFrom(5);
Int result_value = IntFrom(99);- In
Int.Math.c:195:
Int a = IntFrom(3);
Int b = IntFrom(5);
Int result_value = IntFrom(99);- In
Int.Math.c:196:
Int a = IntFrom(3);
Int b = IntFrom(5);
Int result_value = IntFrom(99);
bool result = !IntSub(&result_value, &a, &b);- In
Int.Math.c:210:
WriteFmt("Testing IntMul\n");
Int a = IntFrom(21);
Int b = IntFrom(6);
Int result_value = IntInit();- In
Int.Math.c:211:
Int a = IntFrom(21);
Int b = IntFrom(6);
Int result_value = IntInit();- In
Int.Math.c:212:
Int a = IntFrom(21);
Int b = IntFrom(6);
Int result_value = IntInit();
IntMul(&result_value, &a, &b);- In
Int.Math.c:227:
WriteFmt("Testing IntMul generic dispatch\n");
Int value = IntFromStr("12345678901234567890");
Int result_value = IntInit();
Str text = StrInit();- In
Int.Math.c:228:
Int value = IntFromStr("12345678901234567890");
Int result_value = IntInit();
Str text = StrInit();- In
Int.Math.c:245:
WriteFmt("Testing IntMul with zero\n");
Int a = IntFrom(0);
Int b = IntFrom(12345);
Int result_value = IntInit();- In
Int.Math.c:246:
Int a = IntFrom(0);
Int b = IntFrom(12345);
Int result_value = IntInit();- In
Int.Math.c:247:
Int a = IntFrom(0);
Int b = IntFrom(12345);
Int result_value = IntInit();
IntMul(&result_value, &a, &b);- In
Int.Math.c:263:
WriteFmt("Testing IntSquare\n");
Int value = IntFrom(12345);
Int result_value = IntInit();- In
Int.Math.c:264:
Int value = IntFrom(12345);
Int result_value = IntInit();
IntSquare(&result_value, &value);- In
Int.Math.c:278:
WriteFmt("Testing IntPow generic dispatch\n");
Int base = IntFrom(7);
Int exponent = IntFrom(20);
Int result_value = IntInit();- In
Int.Math.c:279:
Int base = IntFrom(7);
Int exponent = IntFrom(20);
Int result_value = IntInit();
Str text = StrInit();- In
Int.Math.c:280:
Int base = IntFrom(7);
Int exponent = IntFrom(20);
Int result_value = IntInit();
Str text = StrInit();- In
Int.Math.c:302:
WriteFmt("Testing IntDivMod generic dispatch\n");
Int dividend = IntFromStr("12345678901234567890");
Int quotient = IntInit();
Int remainder = IntInit();- In
Int.Math.c:303:
Int dividend = IntFromStr("12345678901234567890");
Int quotient = IntInit();
Int remainder = IntInit();
Str qtext = StrInit();- In
Int.Math.c:304:
Int dividend = IntFromStr("12345678901234567890");
Int quotient = IntInit();
Int remainder = IntInit();
Str qtext = StrInit();- In
Int.Math.c:323:
WriteFmt("Testing IntDiv generic dispatch\n");
Int dividend = IntFrom(126);
Int result_value = IntInit();- In
Int.Math.c:324:
Int dividend = IntFrom(126);
Int result_value = IntInit();
IntDiv(&result_value, ÷nd, 10u);- In
Int.Math.c:338:
WriteFmt("Testing IntDivExact generic dispatch\n");
Int dividend = IntFromStr("12345678901234567890");
Int result_value = IntInit();
Str text = StrInit();- In
Int.Math.c:339:
Int dividend = IntFromStr("12345678901234567890");
Int result_value = IntInit();
Str text = StrInit();- In
Int.Math.c:355:
WriteFmt("Testing IntDivExact failure handling\n");
Int dividend = IntFrom(10);
Int divisor = IntFrom(3);
Int result_value = IntFrom(99);- In
Int.Math.c:356:
Int dividend = IntFrom(10);
Int divisor = IntFrom(3);
Int result_value = IntFrom(99);- In
Int.Math.c:357:
Int dividend = IntFrom(10);
Int divisor = IntFrom(3);
Int result_value = IntFrom(99);
bool result = !IntDivExact(&result_value, ÷nd, &divisor);- In
Int.Math.c:371:
WriteFmt("Testing IntDivMod scalar-divisor dispatch\n");
Int dividend = IntFromStr("12345678901234567890");
Int quotient = IntInit();
Int remainder = IntInit();- In
Int.Math.c:372:
Int dividend = IntFromStr("12345678901234567890");
Int quotient = IntInit();
Int remainder = IntInit();
Str text = StrInit();- In
Int.Math.c:373:
Int dividend = IntFromStr("12345678901234567890");
Int quotient = IntInit();
Int remainder = IntInit();
Str text = StrInit();- In
Int.Math.c:392:
WriteFmt("Testing IntMod generic dispatch\n");
Int dividend = IntFrom(126);
Int result_value = IntInit();- In
Int.Math.c:393:
Int dividend = IntFrom(126);
Int result_value = IntInit();
IntMod(&result_value, ÷nd, 10u);- In
Int.Math.c:407:
WriteFmt("Testing IntMod scalar-divisor dispatch\n");
Int value = IntFromStr("12345678901234567890");
Int remainder = IntInit();- In
Int.Math.c:408:
Int value = IntFromStr("12345678901234567890");
Int remainder = IntInit();
IntMod(&remainder, &value, 97u);- In
Int.Math.c:421:
WriteFmt("Testing IntGCD\n");
Int a = IntFrom(48);
Int b = IntFrom(18);
Int result_value = IntInit();- In
Int.Math.c:422:
Int a = IntFrom(48);
Int b = IntFrom(18);
Int result_value = IntInit();- In
Int.Math.c:423:
Int a = IntFrom(48);
Int b = IntFrom(18);
Int result_value = IntInit();
IntGCD(&result_value, &a, &b);- In
Int.Math.c:438:
WriteFmt("Testing IntLCM\n");
Int a = IntFrom(21);
Int b = IntFrom(6);
Int result_value = IntInit();- In
Int.Math.c:439:
Int a = IntFrom(21);
Int b = IntFrom(6);
Int result_value = IntInit();- In
Int.Math.c:440:
Int a = IntFrom(21);
Int b = IntFrom(6);
Int result_value = IntInit();
IntLCM(&result_value, &a, &b);- In
Int.Math.c:455:
WriteFmt("Testing IntRoot\n");
Int value = IntFrom(4096);
Int result_value = IntInit();- In
Int.Math.c:456:
Int value = IntFrom(4096);
Int result_value = IntInit();
IntRoot(&result_value, &value, 4);- In
Int.Math.c:470:
WriteFmt("Testing IntRootRem\n");
Int value = IntFrom(200);
Int root = IntInit();
Int remainder = IntInit();- In
Int.Math.c:471:
Int value = IntFrom(200);
Int root = IntInit();
Int remainder = IntInit();- In
Int.Math.c:472:
Int value = IntFrom(200);
Int root = IntInit();
Int remainder = IntInit();
IntRootRem(&root, &remainder, &value, 3);- In
Int.Math.c:488:
WriteFmt("Testing IntSqrt\n");
Int value = IntFrom(200);
Int result_value = IntInit();- In
Int.Math.c:489:
Int value = IntFrom(200);
Int result_value = IntInit();
IntSqrt(&result_value, &value);- In
Int.Math.c:503:
WriteFmt("Testing IntSqrtRem\n");
Int value = IntFrom(200);
Int root = IntInit();
Int remainder = IntInit();- In
Int.Math.c:504:
Int value = IntFrom(200);
Int root = IntInit();
Int remainder = IntInit();- In
Int.Math.c:505:
Int value = IntFrom(200);
Int root = IntInit();
Int remainder = IntInit();
IntSqrtRem(&root, &remainder, &value);- In
Int.Math.c:521:
WriteFmt("Testing IntIsPerfectSquare\n");
Int square = IntFrom(144);
Int non_square = IntFrom(145);- In
Int.Math.c:522:
Int square = IntFrom(144);
Int non_square = IntFrom(145);
bool result = IntIsPerfectSquare(&square);- In
Int.Math.c:535:
WriteFmt("Testing IntIsPerfectPower\n");
Int power = IntFrom(81);
Int non_power = IntFrom(82);
Int one = IntFrom(1);- In
Int.Math.c:536:
Int power = IntFrom(81);
Int non_power = IntFrom(82);
Int one = IntFrom(1);- In
Int.Math.c:537:
Int power = IntFrom(81);
Int non_power = IntFrom(82);
Int one = IntFrom(1);
bool result = IntIsPerfectPower(&power);- In
Int.Math.c:552:
WriteFmt("Testing IntJacobi\n");
Int a = IntFrom(5);
Int p = IntFrom(7);
Int b = IntFrom(9);- In
Int.Math.c:553:
Int a = IntFrom(5);
Int p = IntFrom(7);
Int b = IntFrom(9);
Int n = IntFrom(21);- In
Int.Math.c:554:
Int a = IntFrom(5);
Int p = IntFrom(7);
Int b = IntFrom(9);
Int n = IntFrom(21);- In
Int.Math.c:555:
Int p = IntFrom(7);
Int b = IntFrom(9);
Int n = IntFrom(21);
bool result = IntJacobi(&a, &p) == -1;- In
Int.Math.c:570:
WriteFmt("Testing IntSquareMod\n");
Int value = IntFrom(12345);
Int mod = IntFrom(97);
Int result_value = IntInit();- In
Int.Math.c:571:
Int value = IntFrom(12345);
Int mod = IntFrom(97);
Int result_value = IntInit();- In
Int.Math.c:572:
Int value = IntFrom(12345);
Int mod = IntFrom(97);
Int result_value = IntInit();
IntSquareMod(&result_value, &value, &mod);- In
Int.Math.c:587:
WriteFmt("Testing IntModAdd\n");
Int a = IntFrom(100);
Int b = IntFrom(250);
Int m = IntFrom(13);- In
Int.Math.c:588:
Int a = IntFrom(100);
Int b = IntFrom(250);
Int m = IntFrom(13);
Int result_value = IntInit();- In
Int.Math.c:589:
Int a = IntFrom(100);
Int b = IntFrom(250);
Int m = IntFrom(13);
Int result_value = IntInit();- In
Int.Math.c:590:
Int b = IntFrom(250);
Int m = IntFrom(13);
Int result_value = IntInit();
IntModAdd(&result_value, &a, &b, &m);- In
Int.Math.c:606:
WriteFmt("Testing IntModSub\n");
Int a = IntFrom(5);
Int b = IntFrom(9);
Int m = IntFrom(13);- In
Int.Math.c:607:
Int a = IntFrom(5);
Int b = IntFrom(9);
Int m = IntFrom(13);
Int result_value = IntInit();- In
Int.Math.c:608:
Int a = IntFrom(5);
Int b = IntFrom(9);
Int m = IntFrom(13);
Int result_value = IntInit();- In
Int.Math.c:609:
Int b = IntFrom(9);
Int m = IntFrom(13);
Int result_value = IntInit();
IntModSub(&result_value, &a, &b, &m);- In
Int.Math.c:625:
WriteFmt("Testing IntModMul\n");
Int a = IntFrom(123);
Int b = IntFrom(456);
Int m = IntFrom(97);- In
Int.Math.c:626:
Int a = IntFrom(123);
Int b = IntFrom(456);
Int m = IntFrom(97);
Int result_value = IntInit();- In
Int.Math.c:627:
Int a = IntFrom(123);
Int b = IntFrom(456);
Int m = IntFrom(97);
Int result_value = IntInit();- In
Int.Math.c:628:
Int b = IntFrom(456);
Int m = IntFrom(97);
Int result_value = IntInit();
IntModMul(&result_value, &a, &b, &m);- In
Int.Math.c:644:
WriteFmt("Testing IntModDiv\n");
Int a = IntFrom(10);
Int b = IntFrom(3);
Int m = IntFrom(13);- In
Int.Math.c:645:
Int a = IntFrom(10);
Int b = IntFrom(3);
Int m = IntFrom(13);
Int result_value = IntInit();- In
Int.Math.c:646:
Int a = IntFrom(10);
Int b = IntFrom(3);
Int m = IntFrom(13);
Int result_value = IntInit();
Int check = IntInit();- In
Int.Math.c:647:
Int b = IntFrom(3);
Int m = IntFrom(13);
Int result_value = IntInit();
Int check = IntInit();- In
Int.Math.c:648:
Int m = IntFrom(13);
Int result_value = IntInit();
Int check = IntInit();
bool result = IntModDiv(&result_value, &a, &b, &m);- In
Int.Math.c:667:
WriteFmt("Testing IntPowMod scalar-exponent dispatch\n");
Int base = IntFrom(7);
Int mod = IntFrom(13);
Int result_value = IntInit();- In
Int.Math.c:668:
Int base = IntFrom(7);
Int mod = IntFrom(13);
Int result_value = IntInit();- In
Int.Math.c:669:
Int base = IntFrom(7);
Int mod = IntFrom(13);
Int result_value = IntInit();
IntPowMod(&result_value, &base, 20u, &mod);- In
Int.Math.c:682:
bool test_int_pow_mod_integer_exponent(void) {
WriteFmt("Testing IntPowMod Int-exponent dispatch\n");
Int base = IntFrom(4);- In
Int.Math.c:684:
WriteFmt("Testing IntPowMod Int-exponent dispatch\n");
Int base = IntFrom(4);
Int exp = IntFrom(13);
Int mod = IntFrom(497);- In
Int.Math.c:685:
Int base = IntFrom(4);
Int exp = IntFrom(13);
Int mod = IntFrom(497);
Int result_value = IntInit();- In
Int.Math.c:686:
Int base = IntFrom(4);
Int exp = IntFrom(13);
Int mod = IntFrom(497);
Int result_value = IntInit();- In
Int.Math.c:687:
Int exp = IntFrom(13);
Int mod = IntFrom(497);
Int result_value = IntInit();
IntPowMod(&result_value, &base, &exp, &mod);- In
Int.Math.c:703:
WriteFmt("Testing IntModInv\n");
Int value = IntFrom(3);
Int mod = IntFrom(11);
Int result_value = IntInit();- In
Int.Math.c:704:
Int value = IntFrom(3);
Int mod = IntFrom(11);
Int result_value = IntInit();
Int check = IntInit();- In
Int.Math.c:705:
Int value = IntFrom(3);
Int mod = IntFrom(11);
Int result_value = IntInit();
Int check = IntInit();- In
Int.Math.c:706:
Int mod = IntFrom(11);
Int result_value = IntInit();
Int check = IntInit();
bool result = IntModInv(&result_value, &value, &mod);- In
Int.Math.c:724:
WriteFmt("Testing IntModSqrt\n");
Int value = IntFrom(10);
Int mod = IntFrom(13);
Int root = IntInit();- In
Int.Math.c:725:
Int value = IntFrom(10);
Int mod = IntFrom(13);
Int root = IntInit();
Int check = IntInit();- In
Int.Math.c:726:
Int value = IntFrom(10);
Int mod = IntFrom(13);
Int root = IntInit();
Int check = IntInit();- In
Int.Math.c:727:
Int mod = IntFrom(13);
Int root = IntInit();
Int check = IntInit();
bool result = IntModSqrt(&root, &value, &mod);- In
Int.Math.c:743:
WriteFmt("Testing IntModSqrt no-solution case\n");
Int value = IntFrom(3);
Int mod = IntFrom(7);
Int root = IntFrom(99);- In
Int.Math.c:744:
Int value = IntFrom(3);
Int mod = IntFrom(7);
Int root = IntFrom(99);- In
Int.Math.c:745:
Int value = IntFrom(3);
Int mod = IntFrom(7);
Int root = IntFrom(99);
bool result = !IntModSqrt(&root, &value, &mod);- In
Int.Math.c:759:
WriteFmt("Testing IntIsProbablePrime\n");
Int prime = IntFromStr("1000000007");
Int composite = IntFrom(561);- In
Int.Math.c:760:
Int prime = IntFromStr("1000000007");
Int composite = IntFrom(561);
bool result = IntIsProbablePrime(&prime);- In
Int.Math.c:773:
WriteFmt("Testing IntNextPrime\n");
Int value = IntFromStr("1000000000");
Int next = IntInit();
Str text = StrInit();- In
Int.Math.c:774:
Int value = IntFromStr("1000000000");
Int next = IntInit();
Str text = StrInit();- In
Int.Math.c:791:
WriteFmt("Testing IntModInv no-solution case\n");
Int value = IntFrom(6);
Int mod = IntFrom(15);
Int result_value = IntFrom(99);- In
Int.Math.c:792:
Int value = IntFrom(6);
Int mod = IntFrom(15);
Int result_value = IntFrom(99);- In
Int.Math.c:793:
Int value = IntFrom(6);
Int mod = IntFrom(15);
Int result_value = IntFrom(99);
bool result = !IntModInv(&result_value, &value, &mod);- In
Int.Math.c:807:
WriteFmt("Testing IntModDiv no-solution case\n");
Int a = IntFrom(1);
Int b = IntFrom(6);
Int m = IntFrom(15);- In
Int.Math.c:808:
Int a = IntFrom(1);
Int b = IntFrom(6);
Int m = IntFrom(15);
Int result_value = IntFrom(99);- In
Int.Math.c:809:
Int a = IntFrom(1);
Int b = IntFrom(6);
Int m = IntFrom(15);
Int result_value = IntFrom(99);- In
Int.Math.c:810:
Int b = IntFrom(6);
Int m = IntFrom(15);
Int result_value = IntFrom(99);
bool result = !IntModDiv(&result_value, &a, &b, &m);- In
Int.Math.c:825:
WriteFmt("Testing IntAdd NULL result handling\n");
Int a = IntFrom(1);
Int b = IntFrom(2);- In
Int.Math.c:826:
Int a = IntFrom(1);
Int b = IntFrom(2);
IntAdd(NULL, &a, &b);- In
Int.Math.c:840:
bool test_int_div_by_zero(void) {
WriteFmt("Testing Int division by zero handling\n");
Int dividend = IntFrom(1);- In
Int.Math.c:842:
WriteFmt("Testing Int division by zero handling\n");
Int dividend = IntFrom(1);
Int divisor = IntInit();
Int quotient = IntInit();- In
Int.Math.c:843:
Int dividend = IntFrom(1);
Int divisor = IntInit();
Int quotient = IntInit();
Int remainder = IntInit();- In
Int.Math.c:844:
Int dividend = IntFrom(1);
Int divisor = IntInit();
Int quotient = IntInit();
Int remainder = IntInit();- In
Int.Math.c:845:
Int divisor = IntInit();
Int quotient = IntInit();
Int remainder = IntInit();
IntDivMod("ient, &remainder, ÷nd, &divisor);- In
Int.Math.c:854:
WriteFmt("Testing IntRoot zero-degree handling\n");
Int value = IntFrom(16);
Int root = IntInit();
Int remainder = IntInit();- In
Int.Math.c:855:
Int value = IntFrom(16);
Int root = IntInit();
Int remainder = IntInit();- In
Int.Math.c:856:
Int value = IntFrom(16);
Int root = IntInit();
Int remainder = IntInit();
IntRootRem(&root, &remainder, &value, 0);- In
Int.Math.c:865:
WriteFmt("Testing IntDiv scalar zero-divisor handling\n");
Int dividend = IntFrom(10);
Int quotient = IntInit();- In
Int.Math.c:866:
Int dividend = IntFrom(10);
Int quotient = IntInit();
IntDiv("ient, ÷nd, 0u);- In
Int.Math.c:875:
WriteFmt("Testing IntMod scalar zero-modulus handling\n");
Int value = IntFrom(10);
Int result_value = IntInit();- In
Int.Math.c:876:
Int value = IntFrom(10);
Int result_value = IntInit();
IntMod(&result_value, &value, 0u);- In
Int.Math.c:885:
WriteFmt("Testing IntModDiv zero modulus handling\n");
Int a = IntFrom(10);
Int b = IntFrom(3);
Int m = IntInit();- In
Int.Math.c:886:
Int a = IntFrom(10);
Int b = IntFrom(3);
Int m = IntInit();
Int result_value = IntInit();- In
Int.Math.c:887:
Int a = IntFrom(10);
Int b = IntFrom(3);
Int m = IntInit();
Int result_value = IntInit();- In
Int.Math.c:888:
Int b = IntFrom(3);
Int m = IntInit();
Int result_value = IntInit();
(void)IntModDiv(&result_value, &a, &b, &m);- In
Int.Math.c:897:
WriteFmt("Testing IntJacobi even denominator handling\n");
Int a = IntFrom(3);
Int n = IntFrom(8);- In
Int.Math.c:898:
Int a = IntFrom(3);
Int n = IntFrom(8);
(void)IntJacobi(&a, &n);- In
Int.Math.c:907:
WriteFmt("Testing IntPowMod scalar-exponent zero modulus handling\n");
Int base = IntFrom(2);
Int mod = IntInit();
Int result_value = IntInit();- In
Int.Math.c:908:
Int base = IntFrom(2);
Int mod = IntInit();
Int result_value = IntInit();- In
Int.Math.c:909:
Int base = IntFrom(2);
Int mod = IntInit();
Int result_value = IntInit();
IntPowMod(&result_value, &base, 8u, &mod);- In
Int.Math.c:916:
bool test_int_pow_mod_integer_zero_modulus(void) {
WriteFmt("Testing IntPowMod Int-exponent zero modulus handling\n");
Int base = IntFrom(2);- In
Int.Math.c:918:
WriteFmt("Testing IntPowMod Int-exponent zero modulus handling\n");
Int base = IntFrom(2);
Int exp = IntFrom(8);
Int mod = IntInit();- In
Int.Math.c:919:
Int base = IntFrom(2);
Int exp = IntFrom(8);
Int mod = IntInit();
Int result_value = IntInit();- In
Int.Math.c:920:
Int base = IntFrom(2);
Int exp = IntFrom(8);
Int mod = IntInit();
Int result_value = IntInit();- In
Int.Math.c:921:
Int exp = IntFrom(8);
Int mod = IntInit();
Int result_value = IntInit();
IntPowMod(&result_value, &base, &exp, &mod);- In
Int.Math.c:928:
int main(void) {
WriteFmt("[INFO] Starting Int.Math tests\n\n");
TestFunction tests[] = {- In
Int.Math.c:991:
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");
}- In
Int.Type.c:1:
#include <Misra/Std/Container/Int.h>
#include <Misra/Std/Log.h>
#include <Misra/Types.h>- In
Int.Type.c:14:
WriteFmt("Testing IntInit\n");
Int value = IntInit();
bool result = IntIsZero(&value);- In
Int.Type.c:26:
WriteFmt("Testing IntClear\n");
Int value = IntFromBinary("101101");
IntClear(&value);- In
Int.Type.c:40:
WriteFmt("Testing IntClone\n");
Int original = IntFromBinary("1011");
Int clone = IntClone(&original);- In
Int.Type.c:41:
Int original = IntFromBinary("1011");
Int clone = IntClone(&original);
bool result = IntEQ(&clone, &original);- In
Int.Type.c:58:
int main(void) {
WriteFmt("[INFO] Starting Int.Type tests\n\n");
TestFunction tests[] = {- In
Int.Type.c:67:
int total_tests = sizeof(tests) / sizeof(tests[0]);
return run_test_suite(tests, total_tests, NULL, 0, "Int.Type");
}- In
Io.h:140:
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)), \
- In
Io.h:176:
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)), \
- In
Io.h:547:
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);- In
Io.h:564:
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
- In
Container.h:21:
#include <Misra/Std/Container/Map.h>
#include <Misra/Std/Container/BitVec.h>
#include <Misra/Std/Container/Int.h>
#include <Misra/Std/Container/Float.h>- In
Int.h:10:
#define MISRA_STD_CONTAINER_INT_H
#include "Int/Type.h"
#include "Int/Init.h"
#include "Int/Access.h"- In
Int.h:11:
#include "Int/Type.h"
#include "Int/Init.h"
#include "Int/Access.h"
#include "Int/Memory.h"- In
Int.h:12:
#include "Int/Type.h"
#include "Int/Init.h"
#include "Int/Access.h"
#include "Int/Memory.h"
#include "Int/Convert.h"- In
Int.h:13:
#include "Int/Init.h"
#include "Int/Access.h"
#include "Int/Memory.h"
#include "Int/Convert.h"
#include "Int/Private.h"- In
Int.h:14:
#include "Int/Access.h"
#include "Int/Memory.h"
#include "Int/Convert.h"
#include "Int/Private.h"
#include "Int/Compare.h"- In
Int.h:15:
#include "Int/Memory.h"
#include "Int/Convert.h"
#include "Int/Private.h"
#include "Int/Compare.h"
#include "Int/Math.h"- In
Int.h:16:
#include "Int/Convert.h"
#include "Int/Private.h"
#include "Int/Compare.h"
#include "Int/Math.h"- In
Int.h:17:
#include "Int/Private.h"
#include "Int/Compare.h"
#include "Int/Math.h"
#endif // MISRA_STD_CONTAINER_INT_H
- In
Math.h:27:
/// TAGS: Int, Math, ShiftLeft, Bits
///
void IntShiftLeft(Int *value, u64 positions);
///
/// Shift an integer right by the given number of bit positions.
- In
Math.h:39:
/// TAGS: Int, Math, ShiftRight, Bits
///
void IntShiftRight(Int *value, u64 positions);
///
/// Add two integers.
- In
Math.h:52:
/// TAGS: Int, Math, Add
///
void (IntAdd)(Int *result, Int *a, Int *b);
///
/// Subtract one integer from another.
- In
Math.h:67:
/// TAGS: Int, Math, Subtract
///
bool (IntSub)(Int *result, Int *a, Int *b);
///
/// Multiply two integers.
- In
Math.h:80:
/// TAGS: Int, Math, Multiply
///
void (IntMul)(Int *result, Int *a, Int *b);
///
/// Square an integer.
- In
Math.h:92:
/// TAGS: Int, Math, Square
///
void IntSquare(Int *result, Int *value);
///
/// Raise an integer to an arbitrary-precision power.
- In
Math.h:105:
/// TAGS: Int, Math, Power, Exponentiation
///
void (IntPow)(Int *result, Int *base, Int *exponent);
///
/// Divide one integer by another using floor division.
- In
Math.h:120:
/// TAGS: Int, Math, Divide, Quotient
///
void (IntDiv)(Int *result, Int *dividend, Int *divisor);
///
/// Divide one integer by another only when the division is exact.
- In
Math.h:135:
/// TAGS: Int, Math, DivideExact
///
bool (IntDivExact)(Int *result, Int *dividend, Int *divisor);
///
/// Compute `dividend mod divisor`.
- In
Math.h:150:
/// TAGS: Int, Math, Modulo
///
void (IntMod)(Int *result, Int *dividend, Int *divisor);
///
/// Compute quotient and remainder in one call.
- In
Math.h:166:
/// TAGS: Int, Math, Divide, Modulo
///
void (IntDivMod)(Int *quotient, Int *remainder, Int *dividend, Int *divisor);
///
/// Compute the greatest common divisor of two integers.
- In
Math.h:179:
/// TAGS: Int, Math, GCD, NumberTheory
///
void IntGCD(Int *result, Int *a, Int *b);
///
/// Compute the least common multiple of two integers.
- In
Math.h:192:
/// TAGS: Int, Math, LCM, NumberTheory
///
void IntLCM(Int *result, Int *a, Int *b);
///
/// Compute the integer `degree`-th root of a value.
- In
Math.h:205:
/// TAGS: Int, Math, Root, NumberTheory
///
void IntRoot(Int *result, Int *value, u64 degree);
///
/// Compute an integer root and the leftover remainder.
- In
Math.h:219:
/// TAGS: Int, Math, Root, Remainder
///
void IntRootRem(Int *root, Int *remainder, Int *value, u64 degree);
///
/// Compute the integer square root.
- In
Math.h:231:
/// TAGS: Int, Math, Sqrt
///
void IntSqrt(Int *result, Int *value);
///
/// Compute the integer square root and remainder.
- In
Math.h:244:
/// TAGS: Int, Math, Sqrt, Remainder
///
void IntSqrtRem(Int *root, Int *remainder, Int *value);
///
/// Test whether a value is a perfect square.
- In
Math.h:257:
/// TAGS: Int, Math, PerfectSquare, Predicate
///
bool IntIsPerfectSquare(Int *value);
///
/// Test whether a value is a perfect power.
- In
Math.h:270:
/// TAGS: Int, Math, PerfectPower, Predicate
///
bool IntIsPerfectPower(Int *value);
///
/// Compute the Jacobi symbol `(a/n)`.
- In
Math.h:286:
/// TAGS: Int, Math, Jacobi, NumberTheory
///
int IntJacobi(Int *a, Int *n);
///
/// Compute `(value^2) mod modulus`.
- In
Math.h:299:
/// TAGS: Int, Math, Modular, Square
///
void IntSquareMod(Int *result, Int *value, Int *modulus);
///
/// Compute `(a + b) mod modulus`.
- In
Math.h:313:
/// TAGS: Int, Math, Modular, Add
///
void IntModAdd(Int *result, Int *a, Int *b, Int *modulus);
///
/// Compute `(a - b) mod modulus`.
- In
Math.h:327:
/// TAGS: Int, Math, Modular, Subtract
///
void IntModSub(Int *result, Int *a, Int *b, Int *modulus);
///
/// Compute `(a * b) mod modulus`.
- In
Math.h:341:
/// TAGS: Int, Math, Modular, Multiply
///
void IntModMul(Int *result, Int *a, Int *b, Int *modulus);
///
/// Compute modular division `a / b (mod modulus)`.
- In
Math.h:357:
/// TAGS: Int, Math, Modular, Divide
///
bool IntModDiv(Int *result, Int *a, Int *b, Int *modulus);
///
/// Compute `(base^exponent) mod modulus`.
- In
Math.h:371:
/// TAGS: Int, Math, Modular, Power
///
void (IntPowMod)(Int *result, Int *base, Int *exponent, Int *modulus);
///
/// Compute the multiplicative inverse of a value modulo `modulus`.
- In
Math.h:386:
/// TAGS: Int, Math, Modular, Inverse
///
bool IntModInv(Int *result, Int *value, Int *modulus);
///
/// Compute a modular square root.
- In
Math.h:401:
/// TAGS: Int, Math, Modular, Sqrt
///
bool IntModSqrt(Int *result, Int *value, Int *modulus);
///
/// Perform a probabilistic primality test.
- In
Math.h:416:
/// TAGS: Int, Math, Prime, Predicate
///
bool IntIsProbablePrime(Int *value);
///
/// Find the next probable prime greater than or equal to a value.
- In
Math.h:428:
/// TAGS: Int, Math, Prime, Search
///
void IntNextPrime(Int *result, Int *value);
#ifndef __cplusplus- In
Math.h:434:
_Generic( \
(rhs), \
Int: MISRA_PRIV_IntAddValue, \
Int *: IntAdd, \
const Int *: MISRA_PRIV_IntAddConst, \
- In
Math.h:435:
(rhs), \
Int: MISRA_PRIV_IntAddValue, \
Int *: IntAdd, \
const Int *: MISRA_PRIV_IntAddConst, \
unsigned char: MISRA_PRIV_IntAddU64, \
- In
Math.h:436:
Int: MISRA_PRIV_IntAddValue, \
Int *: IntAdd, \
const Int *: MISRA_PRIV_IntAddConst, \
unsigned char: MISRA_PRIV_IntAddU64, \
unsigned short: MISRA_PRIV_IntAddU64, \
- In
Math.h:452:
_Generic( \
(rhs), \
Int: MISRA_PRIV_IntSubValue, \
Int *: IntSub, \
const Int *: MISRA_PRIV_IntSubConst, \
- In
Math.h:453:
(rhs), \
Int: MISRA_PRIV_IntSubValue, \
Int *: IntSub, \
const Int *: MISRA_PRIV_IntSubConst, \
unsigned char: MISRA_PRIV_IntSubU64, \
- In
Math.h:454:
Int: MISRA_PRIV_IntSubValue, \
Int *: IntSub, \
const Int *: MISRA_PRIV_IntSubConst, \
unsigned char: MISRA_PRIV_IntSubU64, \
unsigned short: MISRA_PRIV_IntSubU64, \
- In
Math.h:470:
_Generic( \
(rhs), \
Int: MISRA_PRIV_IntMulValue, \
Int *: IntMul, \
const Int *: MISRA_PRIV_IntMulConst, \
- In
Math.h:471:
(rhs), \
Int: MISRA_PRIV_IntMulValue, \
Int *: IntMul, \
const Int *: MISRA_PRIV_IntMulConst, \
unsigned char: MISRA_PRIV_IntMulU64, \
- In
Math.h:472:
Int: MISRA_PRIV_IntMulValue, \
Int *: IntMul, \
const Int *: MISRA_PRIV_IntMulConst, \
unsigned char: MISRA_PRIV_IntMulU64, \
unsigned short: MISRA_PRIV_IntMulU64, \
- In
Math.h:488:
_Generic( \
(exponent), \
Int: MISRA_PRIV_IntPowValue, \
Int *: IntPow, \
const Int *: MISRA_PRIV_IntPowConst, \
- In
Math.h:489:
(exponent), \
Int: MISRA_PRIV_IntPowValue, \
Int *: IntPow, \
const Int *: MISRA_PRIV_IntPowConst, \
unsigned char: MISRA_PRIV_IntPowU64, \
- In
Math.h:490:
Int: MISRA_PRIV_IntPowValue, \
Int *: IntPow, \
const Int *: MISRA_PRIV_IntPowConst, \
unsigned char: MISRA_PRIV_IntPowU64, \
unsigned short: MISRA_PRIV_IntPowU64, \
- In
Math.h:506:
_Generic( \
(divisor), \
Int: MISRA_PRIV_IntDivValue, \
Int *: IntDiv, \
const Int *: MISRA_PRIV_IntDivConst, \
- In
Math.h:507:
(divisor), \
Int: MISRA_PRIV_IntDivValue, \
Int *: IntDiv, \
const Int *: MISRA_PRIV_IntDivConst, \
unsigned char: MISRA_PRIV_IntDivU64, \
- In
Math.h:508:
Int: MISRA_PRIV_IntDivValue, \
Int *: IntDiv, \
const Int *: MISRA_PRIV_IntDivConst, \
unsigned char: MISRA_PRIV_IntDivU64, \
unsigned short: MISRA_PRIV_IntDivU64, \
- In
Math.h:524:
_Generic( \
(divisor), \
Int: MISRA_PRIV_IntDivExactValue, \
Int *: IntDivExact, \
const Int *: MISRA_PRIV_IntDivExactConst, \
- In
Math.h:525:
(divisor), \
Int: MISRA_PRIV_IntDivExactValue, \
Int *: IntDivExact, \
const Int *: MISRA_PRIV_IntDivExactConst, \
unsigned char: MISRA_PRIV_IntDivExactU64, \
- In
Math.h:526:
Int: MISRA_PRIV_IntDivExactValue, \
Int *: IntDivExact, \
const Int *: MISRA_PRIV_IntDivExactConst, \
unsigned char: MISRA_PRIV_IntDivExactU64, \
unsigned short: MISRA_PRIV_IntDivExactU64, \
- In
Math.h:542:
_Generic( \
(divisor), \
Int: MISRA_PRIV_IntModValue, \
Int *: IntMod, \
const Int *: MISRA_PRIV_IntModConst, \
- In
Math.h:543:
(divisor), \
Int: MISRA_PRIV_IntModValue, \
Int *: IntMod, \
const Int *: MISRA_PRIV_IntModConst, \
unsigned char: MISRA_PRIV_IntModU64Into, \
- In
Math.h:544:
Int: MISRA_PRIV_IntModValue, \
Int *: IntMod, \
const Int *: MISRA_PRIV_IntModConst, \
unsigned char: MISRA_PRIV_IntModU64Into, \
unsigned short: MISRA_PRIV_IntModU64Into, \
- In
Math.h:560:
_Generic( \
(divisor), \
Int: MISRA_PRIV_IntDivModValue, \
Int *: IntDivMod, \
const Int *: MISRA_PRIV_IntDivModConst, \
- In
Math.h:561:
(divisor), \
Int: MISRA_PRIV_IntDivModValue, \
Int *: IntDivMod, \
const Int *: MISRA_PRIV_IntDivModConst, \
unsigned char: MISRA_PRIV_IntDivModU64, \
- In
Math.h:562:
Int: MISRA_PRIV_IntDivModValue, \
Int *: IntDivMod, \
const Int *: MISRA_PRIV_IntDivModConst, \
unsigned char: MISRA_PRIV_IntDivModU64, \
unsigned short: MISRA_PRIV_IntDivModU64, \
- In
Math.h:578:
_Generic( \
(exponent), \
Int: MISRA_PRIV_IntPowModValue, \
Int *: IntPowMod, \
const Int *: MISRA_PRIV_IntPowModConst, \
- In
Math.h:579:
(exponent), \
Int: MISRA_PRIV_IntPowModValue, \
Int *: IntPowMod, \
const Int *: MISRA_PRIV_IntPowModConst, \
unsigned char: MISRA_PRIV_IntPowU64Mod, \
- In
Math.h:580:
Int: MISRA_PRIV_IntPowModValue, \
Int *: IntPowMod, \
const Int *: MISRA_PRIV_IntPowModConst, \
unsigned char: MISRA_PRIV_IntPowU64Mod, \
unsigned short: MISRA_PRIV_IntPowU64Mod, \
- In
Convert.h:65:
/// TAGS: Int, Convert, U64, Export
///
u64 IntToU64(Int *value);
///
- In
Convert.h:80:
/// TAGS: Int, Convert, Bytes, LittleEndian, Import
///
Int IntFromBytesLE(const u8 *bytes, u64 len);
///
- In
Convert.h:96:
/// TAGS: Int, Convert, Bytes, LittleEndian, Export
///
u64 IntToBytesLE(Int *value, u8 *bytes, u64 max_len);
///
- In
Convert.h:111:
/// TAGS: Int, Convert, Bytes, BigEndian, Import
///
Int IntFromBytesBE(const u8 *bytes, u64 len);
///
- In
Convert.h:127:
/// TAGS: Int, Convert, Bytes, BigEndian, Export
///
u64 IntToBytesBE(Int *value, u8 *bytes, u64 max_len);
///
- In
Convert.h:145:
/// TAGS: Int, Convert, String, Radix, Import
///
Int IntFromStrRadix(const char *digits, u8 radix);
///
- In
Convert.h:161:
/// TAGS: Int, Convert, String, Radix, Export
///
Str IntToStrRadix(Int *value, u8 radix, bool uppercase);
///
- In
Convert.h:176:
/// TAGS: Int, Convert, Decimal, String, Import
///
Int IntFromStr(const char *decimal);
///
- In
Convert.h:190:
/// TAGS: Int, Convert, Decimal, String, Export
///
Str IntToStr(Int *value);
///
- In
Convert.h:205:
/// TAGS: Int, Convert, Binary, String, Import
///
Int IntFromBinary(const char *binary);
///
- In
Convert.h:219:
/// TAGS: Int, Convert, Binary, String, Export
///
Str IntToBinary(Int *value);
///
- In
Convert.h:234:
/// TAGS: Int, Convert, Octal, String, Import
///
Int IntFromOctStr(const char *octal);
///
- In
Convert.h:248:
/// TAGS: Int, Convert, Octal, String, Export
///
Str IntToOctStr(Int *value);
///
- In
Convert.h:265:
/// TAGS: Int, Convert, Hex, String, Import
///
Int IntFromHexStr(const char *hex);
///
- In
Convert.h:279:
/// TAGS: Int, Convert, Hex, String, Export
///
Str IntToHexStr(Int *value);
#ifdef __cplusplus- In
Compare.h:29:
/// TAGS: Int, Compare, Ordering
///
int (IntCompare)(Int *lhs, Int *rhs);
#ifndef __cplusplus- In
Compare.h:35:
_Generic( \
(rhs), \
Int: MISRA_PRIV_IntCompareValue, \
Int *: IntCompare, \
const Int *: MISRA_PRIV_IntCompareConst, \
- In
Compare.h:36:
(rhs), \
Int: MISRA_PRIV_IntCompareValue, \
Int *: IntCompare, \
const Int *: MISRA_PRIV_IntCompareConst, \
unsigned char: MISRA_PRIV_IntCompareU64, \
- In
Compare.h:37:
Int: MISRA_PRIV_IntCompareValue, \
Int *: IntCompare, \
const Int *: MISRA_PRIV_IntCompareConst, \
unsigned char: MISRA_PRIV_IntCompareU64, \
unsigned short: MISRA_PRIV_IntCompareU64, \
- In
Init.h:21:
/// TAGS: Int, Init, Zero, Construct
///
static inline Int IntInit(void) {
Int value;- In
Init.h:22:
///
static inline Int IntInit(void) {
Int value;
value.bits = BitVecInit();- In
Init.h:39:
/// TAGS: Int, Deinit, Destroy, Memory
///
static inline void IntDeinit(Int *value) {
ValidateInt(value);
BitVecDeinit(&value->bits);- In
Init.h:54:
/// TAGS: Int, Clear, Zero, Reset
///
static inline void IntClear(Int *value) {
ValidateInt(value);
BitVecClear(&value->bits);- In
Memory.h:28:
/// TAGS: Int, Memory, Clone, Copy
///
Int IntClone(Int *value);
#ifdef __cplusplus- In
Access.h:28:
/// TAGS: Int, Access, Bits, Length
///
u64 IntBitLength(Int *value);
///
- In
Access.h:42:
/// TAGS: Int, Access, Bytes, Length
///
u64 IntByteLength(Int *value);
///
- In
Access.h:58:
/// TAGS: Int, Access, Log2, Bits
///
u64 IntLog2(Int *value);
///
- In
Access.h:72:
/// TAGS: Int, Access, TrailingZeroes, Bits
///
u64 IntTrailingZeroCount(Int *value);
///
- In
Access.h:86:
/// TAGS: Int, Access, Zero, Predicate
///
bool IntIsZero(Int *value);
///
- In
Access.h:100:
/// TAGS: Int, Access, One, Predicate
///
bool IntIsOne(Int *value);
///
- In
Access.h:114:
/// TAGS: Int, Access, Even, Predicate
///
bool IntIsEven(Int *value);
///
- In
Access.h:128:
/// TAGS: Int, Access, Odd, Predicate
///
bool IntIsOdd(Int *value);
///
- In
Access.h:142:
/// TAGS: Int, Access, Convert, Range
///
bool IntFitsU64(Int *value);
///
- In
Access.h:156:
/// TAGS: Int, Access, PowerOfTwo, Predicate
///
bool IntIsPowerOfTwo(Int *value);
#ifdef __cplusplus- In
Type.h:26:
typedef struct {
BitVec bits;
} Int;
///
- In
Type.h:39:
/// TAGS: Int, Validate, Safety, Debug
///
static inline void ValidateInt(const Int *value) {
ValidateBitVec(value ? &value->bits : NULL);
}- In
Math.h:103:
Float *: FloatAdd, \
const Float *: MISRA_PRIV_FloatAddConstFloat, \
Int: MISRA_PRIV_FloatAddValueInt, \
Int *: MISRA_PRIV_FloatAddInt, \
const Int *: MISRA_PRIV_FloatAddConstInt, \
- In
Math.h:104:
const Float *: MISRA_PRIV_FloatAddConstFloat, \
Int: MISRA_PRIV_FloatAddValueInt, \
Int *: MISRA_PRIV_FloatAddInt, \
const Int *: MISRA_PRIV_FloatAddConstInt, \
unsigned char: MISRA_PRIV_FloatAddU64, \
- In
Math.h:105:
Int: MISRA_PRIV_FloatAddValueInt, \
Int *: MISRA_PRIV_FloatAddInt, \
const Int *: MISRA_PRIV_FloatAddConstInt, \
unsigned char: MISRA_PRIV_FloatAddU64, \
unsigned short: MISRA_PRIV_FloatAddU64, \
- In
Math.h:126:
Float *: FloatSub, \
const Float *: MISRA_PRIV_FloatSubConstFloat, \
Int: MISRA_PRIV_FloatSubValueInt, \
Int *: MISRA_PRIV_FloatSubInt, \
const Int *: MISRA_PRIV_FloatSubConstInt, \
- In
Math.h:127:
const Float *: MISRA_PRIV_FloatSubConstFloat, \
Int: MISRA_PRIV_FloatSubValueInt, \
Int *: MISRA_PRIV_FloatSubInt, \
const Int *: MISRA_PRIV_FloatSubConstInt, \
unsigned char: MISRA_PRIV_FloatSubU64, \
- In
Math.h:128:
Int: MISRA_PRIV_FloatSubValueInt, \
Int *: MISRA_PRIV_FloatSubInt, \
const Int *: MISRA_PRIV_FloatSubConstInt, \
unsigned char: MISRA_PRIV_FloatSubU64, \
unsigned short: MISRA_PRIV_FloatSubU64, \
- In
Math.h:149:
Float *: FloatMul, \
const Float *: MISRA_PRIV_FloatMulConstFloat, \
Int: MISRA_PRIV_FloatMulValueInt, \
Int *: MISRA_PRIV_FloatMulInt, \
const Int *: MISRA_PRIV_FloatMulConstInt, \
- In
Math.h:150:
const Float *: MISRA_PRIV_FloatMulConstFloat, \
Int: MISRA_PRIV_FloatMulValueInt, \
Int *: MISRA_PRIV_FloatMulInt, \
const Int *: MISRA_PRIV_FloatMulConstInt, \
unsigned char: MISRA_PRIV_FloatMulU64, \
- In
Math.h:151:
Int: MISRA_PRIV_FloatMulValueInt, \
Int *: MISRA_PRIV_FloatMulInt, \
const Int *: MISRA_PRIV_FloatMulConstInt, \
unsigned char: MISRA_PRIV_FloatMulU64, \
unsigned short: MISRA_PRIV_FloatMulU64, \
- In
Math.h:172:
Float *: FloatDiv, \
const Float *: MISRA_PRIV_FloatDivConstFloat, \
Int: MISRA_PRIV_FloatDivValueInt, \
Int *: MISRA_PRIV_FloatDivInt, \
const Int *: MISRA_PRIV_FloatDivConstInt, \
- In
Math.h:173:
const Float *: MISRA_PRIV_FloatDivConstFloat, \
Int: MISRA_PRIV_FloatDivValueInt, \
Int *: MISRA_PRIV_FloatDivInt, \
const Int *: MISRA_PRIV_FloatDivConstInt, \
unsigned char: MISRA_PRIV_FloatDivU64, \
- In
Math.h:174:
Int: MISRA_PRIV_FloatDivValueInt, \
Int *: MISRA_PRIV_FloatDivInt, \
const Int *: MISRA_PRIV_FloatDivConstInt, \
unsigned char: MISRA_PRIV_FloatDivU64, \
unsigned short: MISRA_PRIV_FloatDivU64, \
- In
Convert.h:21:
_Generic( \
(value), \
Int: MISRA_PRIV_FloatFromValueInt, \
Int *: MISRA_PRIV_FloatFromInt, \
const Int *: MISRA_PRIV_FloatFromConstInt, \
- In
Convert.h:22:
(value), \
Int: MISRA_PRIV_FloatFromValueInt, \
Int *: MISRA_PRIV_FloatFromInt, \
const Int *: MISRA_PRIV_FloatFromConstInt, \
unsigned char: MISRA_PRIV_FloatFromU64, \
- In
Convert.h:23:
Int: MISRA_PRIV_FloatFromValueInt, \
Int *: MISRA_PRIV_FloatFromInt, \
const Int *: MISRA_PRIV_FloatFromConstInt, \
unsigned char: MISRA_PRIV_FloatFromU64, \
unsigned short: MISRA_PRIV_FloatFromU64, \
- In
Convert.h:66:
/// TAGS: Float, Convert, Int, Export
///
bool FloatToInt(Int *result, Float *value);
///
/// Parse a decimal string into a float.
- In
Compare.h:37:
Float *: FloatCompare, \
const Float *: MISRA_PRIV_FloatCompareConstFloat, \
Int: MISRA_PRIV_FloatCompareValueInt, \
Int *: MISRA_PRIV_FloatCompareInt, \
const Int *: MISRA_PRIV_FloatCompareConstInt, \
- In
Compare.h:38:
const Float *: MISRA_PRIV_FloatCompareConstFloat, \
Int: MISRA_PRIV_FloatCompareValueInt, \
Int *: MISRA_PRIV_FloatCompareInt, \
const Int *: MISRA_PRIV_FloatCompareConstInt, \
unsigned char: MISRA_PRIV_FloatCompareU64, \
- In
Compare.h:39:
Int: MISRA_PRIV_FloatCompareValueInt, \
Int *: MISRA_PRIV_FloatCompareInt, \
const Int *: MISRA_PRIV_FloatCompareConstInt, \
unsigned char: MISRA_PRIV_FloatCompareU64, \
unsigned short: MISRA_PRIV_FloatCompareU64, \
- In
Init.h:11:
#include "Type.h"
#include <Misra/Std/Container/Int/Init.h>
///
- In
Type.h:10:
#define MISRA_STD_CONTAINER_FLOAT_TYPE_H
#include <Misra/Std/Container/Int/Type.h>
///
- In
Type.h:28:
typedef struct {
bool negative;
Int significand;
i64 exponent;
} Float;
Last updated on