IntTryClone
Description
Create a deep copy of an integer.
Parameters
| Name | Direction | Description |
|---|---|---|
value |
in | Integer to clone |
Returns
true on success, false if cloning fails.
Usage example (Cross-references)
Usage examples (Cross-references)
- In
Float.c:257:
out->negative = value->negative;
out->exponent = value->exponent;
if (!IntTryClone(&out->significand, &value->significand)) {
FloatDeinit(out);
*out = FloatInit(value->significand.bits.allocator);- In
Float.c:312:
ValidateInt(value);
*out = FloatInit(value->bits.allocator);
if (!IntTryClone(&out->significand, value)) {
FloatDeinit(out);
*out = FloatInit(value->bits.allocator);- In
Float.c:382:
Int factor = IntInit(value->significand.bits.allocator);
if (!IntTryClone(&temp, &value->significand) ||
!float_pow10(&factor, (u64)value->exponent, value->significand.bits.allocator) ||
!int_mul(&temp, &temp, &factor)) {- In
Int.c:460:
}
bool IntTryClone(Int *out, Int *value) {
return int_try_clone_value(out, value);
}- In
Int.c:1610:
Int zero_rem = IntInit(remainder->bits.allocator);
if (!IntTryClone(&exact_root, value)) {
IntDeinit(&exact_root);
IntDeinit(&zero_rem);- In
Int.c:1684:
IntDeinit(&best);
if (!IntTryClone(&best, &mid)) {
IntDeinit(&mid_pow);
IntDeinit(&mid);- In
Int.c:2132:
Int exp = IntInit(exponent->bits.allocator);
if (!int_try_from_u64_with_allocator(&acc, 1, result->bits.allocator) || !IntTryClone(&exp, exponent) ||
!int_mod(&acc, &acc, modulus) || !int_mod(&base_mod, base, modulus)) {
IntDeinit(&acc);- In
Int.c:2208:
bool ok = false;
if (!IntTryClone(&r, modulus) || !int_mod(&reduced, value, modulus)) {
IntDeinit(&reduced);
IntDeinit(&r);- In
Int.c:2217:
return false;
}
if (!IntTryClone(&new_r, &reduced)) {
IntDeinit(&reduced);
IntDeinit(&r);- In
Int.c:2372:
Int root = IntInit();
if (!IntTryClone(&exponent, modulus) || !int_add_u64(&exponent, &exponent, 1) || !IntShiftRight(&exponent, 2) ||
!int_pow_mod(&root, &a, &exponent, modulus)) {
IntDeinit(&exponent);- In
Int.c:2395:
u64 m = 0;
if (!IntTryClone(&q, modulus) || !int_try_from_u64_with_allocator(&z, 2, modulus->bits.allocator) ||
!int_sub_u64(&q, &q, 1)) {
IntDeinit(&q);- In
Int.c:2461:
}
if (!IntTryClone(&exponent, &q) || !int_add_u64(&exponent, &exponent, 1) || !IntShiftRight(&exponent, 1) ||
!int_pow_mod(&r, &a, &exponent, modulus)) {
IntDeinit(&q);- In
Int.c:2477:
u64 i = 0;
if (!IntTryClone(&t_power, &t)) {
IntDeinit(&t_power);
IntDeinit(&q);- In
Int.c:2522:
Int next = IntInit();
if (!IntTryClone(&b, &c)) {
IntDeinit(&b);
IntDeinit(&b_sq);- In
Int.c:2667:
bool probable = true;
if (!IntTryClone(&d, value) || !int_sub_u64(&d, &d, 1)) {
IntDeinit(&d);
IntDeinit(&n_minus_one);- In
Int.c:2672:
return false;
}
if (!IntTryClone(&n_minus_one, &d)) {
IntDeinit(&d);
IntDeinit(&n_minus_one);- In
Int.c:2778:
Int candidate = IntInit(result->bits.allocator);
if (!IntTryClone(&candidate, value)) {
IntDeinit(&candidate);
return false;
Last updated on