IntClone
IntClone
Description
Create a deep copy of an integer.
Parameters
| Name | Direction | Description |
|---|---|---|
value |
in | Integer to clone |
Usage example (from documentation)
Int copy = IntClone(&value);Returns
Independent copy of value.
Usage example (Cross-references)
Usage examples (Cross-references)
- In
Float.c:171:
clone.negative = value->negative;
clone.exponent = value->exponent;
clone.significand = IntClone(&value->significand);
return clone;
}- In
Float.c:203:
ValidateInt(value);
result.significand = IntClone(value);
float_normalize(&result);
return result;- In
Float.c:236:
Int factor = IntInit();
temp = IntClone(&value->significand);
factor = float_pow10((u64)value->exponent);
IntMul(&temp, &temp, &factor);- In
Int.c:99:
static SignedInt sint_clone(SignedInt *value) {
SignedInt clone = {.negative = value->negative, .magnitude = IntClone(&value->magnitude)};
sint_normalize(&clone);
return clone;- 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: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:343:
}
Int IntClone(Int *value) {
ValidateInt(value);- In
Int.c:520:
}
Int current = IntClone(value);
Str result = StrInit();- In
Int.c:734:
ValidateInt(value);
Int temp = IntClone(value);
int_add_u64_in_place(&temp, addend);- In
Int.c:835:
}
Int partial = IntClone(a);
Int next = IntInit();- In
Int.c:857:
ValidateInt(value);
Int temp = IntClone(value);
int_mul_u64_in_place(&temp, factor);- In
Int.c:892:
Int acc = MISRA_PRIV_IntFromU64(1);
Int current = IntClone(base);
while (exponent > 0) {- 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: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: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:1184:
}
if (degree == 1) {
Int exact_root = IntClone(value);
Int zero_rem = IntInit();- In
Int.c:1225:
IntDeinit(&best);
best = IntClone(&mid);
IntAdd(&next, &mid, &one);
IntDeinit(&low);- In
Int.c:1332:
Int aa = IntInit();
Int nn = IntClone(n);
int result = 1;- 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: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:1588:
IntMod(&reduced, value, modulus);
new_r = IntClone(&reduced);
while (!IntIsZero(&new_r)) {- In
Int.c:1674:
}
if (MISRA_PRIV_IntModU64(modulus, 4) == 3) {
Int exponent = IntClone(modulus);
Int root = IntInit();- In
Int.c:1688:
{
Int q = IntClone(modulus);
Int z = MISRA_PRIV_IntFromU64(2);
Int c = IntInit();- In
Int.c:1709:
IntPowMod(&t, &a, &q, modulus);
exponent = IntClone(&q);
MISRA_PRIV_IntAddU64(&exponent, &exponent, 1);
IntShiftRight(&exponent, 1);- In
Int.c:1715:
while (MISRA_PRIV_IntCompareU64(&t, 1) != 0) {
Int t_power = IntClone(&t);
u64 i = 0;- In
Int.c:1736:
{
Int b = IntClone(&c);
Int b_sq = IntInit();
Int next = IntInit();- In
Int.c:1810:
{
Int d = IntClone(value);
Int n_minus_one = IntInit();
u64 s = 0;- In
Int.c:1816:
(void)MISRA_PRIV_IntSubU64(&d, &d, 1);
n_minus_one = IntClone(&d);
while (IntIsEven(&d)) {- In
Int.c:1884:
}
Int candidate = IntClone(value);
MISRA_PRIV_IntAddU64(&candidate, &candidate, 1);- In
Int.Type.c:38:
bool test_int_clone(void) {
WriteFmt("Testing IntClone\n");
Int original = IntFromBinary("1011");- In
Int.Type.c:41:
Int original = IntFromBinary("1011");
Int clone = IntClone(&original);
bool result = IntEQ(&clone, &original);
Last updated on