IntClear
Description
Reset an integer back to zero while preserving the object itself.
Parameters
| Name | Direction | Description |
|---|---|---|
value |
in,out | Integer to clear |
Success
Numeric value becomes 0; backing bitvector capacity is retained.
Failure
Cannot fail; aborts on a corrupted magic via the validator.
Usage example (Cross-references)
Usage examples (Cross-references)
- In
Init.h:64:
static inline void FloatClear(Float *value) {
ValidateFloat(value);
IntClear(&value->significand);
value->negative = false;
value->exponent = 0;- In
Int.c:1100:
}
if (bits == 0) {
IntClear(value);
return true;
}- In
Int.c:1140:
}
if (bits == 0 || positions >= bits) {
IntClear(value);
return true;
}- In
Int.c:1425:
if (IntIsZero(a) || IntIsZero(b)) {
IntClear(result);
return true;
}- In
Int.c:1458:
// Whole 64-bit limbs (a_words + b_words holds any product), zero-filled,
// so every limb store is in bounds and accumulation starts clean.
IntClear(result);
if (!BitVecResize(INT_BITS(result), r_words * 64u)) {
goto cleanup;- In
Int.c:1627:
return false;
}
IntClear(quotient);
int_replace(remainder, &r0);
return true;- In
Int.c:1665:
// or re-scans. The remainder needs divisor_bits+1 bits at most, rounded up
// to a whole limb so its shift never runs off the buffer.
IntClear(quotient);
IntClear(remainder);
if (!BitVecResize(INT_BITS(quotient), dividend_bits) || !BitVecResize(INT_BITS(remainder), r_words * 64u)) {- In
Int.c:1666:
// to a whole limb so its shift never runs off the buffer.
IntClear(quotient);
IntClear(remainder);
if (!BitVecResize(INT_BITS(quotient), dividend_bits) || !BitVecResize(INT_BITS(remainder), r_words * 64u)) {
goto cleanup;- In
Int.Type.c:32:
bool test_int_clear(void) {
WriteFmt("Testing IntClear\n");
DefaultAllocator alloc = DefaultAllocatorInit();- In
Int.Type.c:38:
Int value = IntFromBinary("101101", &alloc.base);
IntClear(&value);
bool result = IntIsZero(&value);
Last updated on