IntIsZero
Description
Test whether the integer equals zero.
Parameters
| Name | Direction | Description |
|---|---|---|
value |
in | Integer to inspect. |
Success
Returns true when the integer represents zero.
Failure
Returns false for any non-zero value.
Usage example (Cross-references)
Usage examples (Cross-references)
- In
Float.c:253:
ValidateFloat(value);
if (IntIsZero(&value->significand)) {
value->negative = false;
value->exponent = 0;- In
Float.c:271:
bool FloatIsZero(const Float *value) {
ValidateFloat(value);
return IntIsZero(&value->significand);
}- In
Float.c:565:
}
result.negative = negative && !IntIsZero(&result.significand);
result.exponent = explicit_exp - fractional;- In
Int.c:139:
static void sint_normalize(SignedInt *value) {
int_normalize(&value->magnitude);
if (IntIsZero(&value->magnitude)) {
value->negative = false;
}- In
Int.c:192:
SignedInt neg_b = sint_clone(b);
if (!IntIsZero(&neg_b.magnitude)) {
neg_b.negative = !neg_b.negative;
}- In
Int.c:381:
ValidateInt(value);
if (IntIsZero(value)) {
LOG_ERROR("log2 undefined for zero");
return false;- In
Int.c:413:
}
bool IntIsZero(const Int *value) {
return IntBitLength(value) == 0;
}- In
Int.c:438:
ValidateInt(value);
return !IntIsZero(value) && IntBitLength(value) == IntTrailingZeroCount(value) + 1;
}- In
Int.c:737:
}
if (IntIsZero(value)) {
return StrPushBackR(out, '0');
}- In
Int.c:742:
current = IntClone(value);
if (IntIsZero(¤t)) {
return false;
}- In
Int.c:748:
result = StrInit(alloc);
while (!IntIsZero(¤t)) {
Int quotient = IntInit(alloc);
u64 digit = 0;- In
Int.c:1212:
Int acc = IntInit(IntAllocator(result));
if (IntIsZero(a) || IntIsZero(b)) {
IntDeinit(result);
*result = acc;- In
Int.c:1358:
LOG_FATAL("quotient and remainder must be different objects");
}
if (IntIsZero(divisor)) {
LOG_ERROR("Division by zero");
return false;- In
Int.c:1455:
ValidateInt(divisor);
if (IntIsZero(divisor)) {
LOG_ERROR("Division by zero");
return false;- In
Int.c:1468:
return false;
}
if (!IntIsZero(&remainder)) {
IntDeinit("ient);
IntDeinit(&remainder);- In
Int.c:1648:
}
while (!IntIsZero(&y)) {
Int r = IntInit(IntAllocator(result));- In
Int.c:1672:
ValidateInt(b);
if (IntIsZero(a) || IntIsZero(b)) {
Int zero = IntInit(IntAllocator(result));
int_replace(result, &zero);- In
Int.c:1708:
}
if (IntIsZero(value)) {
Int zero_root = IntInit(IntAllocator(root));
Int zero_rem = IntInit(IntAllocator(remainder));- In
Int.c:1818:
Int next = IntInit(IntAllocator(root));
if (IntEQ(&mid, &one) || IntIsZero(&mid)) {
IntDeinit(&high);
high = IntInit(IntAllocator(root));- In
Int.c:1902:
return false;
}
result = IntIsZero(&remainder);
IntDeinit(&root);- In
Int.c:1912:
ValidateInt(value);
if (IntIsZero(value) || IntBitLength(value) == 1) {
return true;
}- In
Int.c:1932:
return false;
}
exact = IntIsZero(&remainder);
IntDeinit(&root);- In
Int.c:1953:
}
if (IntIsZero(n) || IntIsEven(n)) {
LOG_ERROR("n must be non-zero and odd");
return false;- In
Int.c:1968:
}
while (!IntIsZero(&aa)) {
while (IntIsEven(&aa)) {
u64 n_mod_8 = 0;- In
Int.c:2025:
ValidateInt(modulus);
if (IntIsZero(modulus)) {
LOG_ERROR("modulus is zero");
return false;- In
Int.c:2054:
ValidateInt(modulus);
if (IntIsZero(modulus)) {
LOG_ERROR("modulus is zero");
return false;- In
Int.c:2083:
return false;
}
if (IntIsZero(&diff)) {
Int zero = IntInit(IntAllocator(result));
int_replace(result, &zero);- In
Int.c:2109:
ValidateInt(modulus);
if (IntIsZero(modulus)) {
LOG_ERROR("modulus is zero");
return false;- In
Int.c:2138:
ValidateInt(modulus);
if (IntIsZero(modulus)) {
LOG_ERROR("modulus is zero");
return false;- In
Int.c:2174:
ValidateInt(modulus);
if (IntIsZero(modulus)) {
LOG_FATAL("modulus is zero");
}- In
Int.c:2231:
ValidateInt(modulus);
if (IntIsZero(modulus)) {
LOG_ERROR("modulus is zero");
return false;- In
Int.c:2248:
}
while (!IntIsZero(&exp)) {
if (int_is_odd(&exp)) {
Int next = IntInit(IntAllocator(result));- In
Int.c:2269:
return false;
}
if (!IntIsZero(&exp)) {
Int next = IntInit(IntAllocator(result));- In
Int.c:2303:
ValidateInt(modulus);
if (IntIsZero(modulus)) {
LOG_ERROR("modulus is zero");
return false;- In
Int.c:2335:
}
while (!IntIsZero(&new_r)) {
Int q = IntInit(IntAllocator(result));
Int rem = IntInit(IntAllocator(result));- In
Int.c:2388:
return false;
}
if (t.negative && !IntIsZero(&mag_mod)) {
if (!int_sub(&positive, modulus, &mag_mod)) {
IntDeinit(&positive);- In
Int.c:2433:
ValidateInt(modulus);
if (IntIsZero(modulus)) {
LOG_ERROR("modulus is zero");
return false;- In
Int.c:2446:
}
if (IntIsZero(&a)) {
Int zero = IntInit(IntAllocator(result));
int_replace(result, &zero);- In
Int.Access.c:48:
bool test_int_is_zero(void) {
WriteFmt("Testing IntIsZero\n");
DefaultAllocator alloc = DefaultAllocatorInit();- In
Int.Access.c:55:
Int non_zero = IntFrom(1, &alloc.base);
bool result = IntIsZero(&zero);
result = result && !IntIsZero(&non_zero);- In
Int.Access.c:56:
bool result = IntIsZero(&zero);
result = result && !IntIsZero(&non_zero);
IntDeinit(&zero);
bool result = IntBitLength(&zero) == 0;
result = result && IntIsZero(&zero);
result = result && (IntToU64(&zero, &error) == 0);
result = result && !error; bool result = !IntTryFromBinary(&value, "10a1");
result = result && IntIsZero(&parsed);
result = result && IntIsZero(&value);
result = result && IntIsZero(&parsed);
result = result && IntIsZero(&value);
IntDeinit(&parsed); bool result = !IntTryFromStr(&value, "12x3");
result = result && IntIsZero(&parsed);
result = result && IntIsZero(&value);
result = result && IntIsZero(&parsed);
result = result && IntIsZero(&value);
IntDeinit(&parsed); bool result = !IntTryFromHexStr(&value, "12g3");
result = result && IntIsZero(&parsed);
result = result && IntIsZero(&value);
result = result && IntIsZero(&parsed);
result = result && IntIsZero(&value);
IntDeinit(&parsed); bool result = !IntTryFromStrRadix(&value, "102", 2);
result = result && IntIsZero(&parsed);
result = result && IntIsZero(&value);
result = result && IntIsZero(&parsed);
result = result && IntIsZero(&value);
IntDeinit(&parsed); bool result = !IntTryFromStrRadix(&value, "10", 1);
result = result && IntIsZero(&parsed);
result = result && IntIsZero(&value);
result = result && IntIsZero(&parsed);
result = result && IntIsZero(&value);
IntDeinit(&parsed); bool result = !IntTryFromBinary(&value, (Zstr)NULL);
result = result && IntIsZero(&parsed);
result = result && IntIsZero(&value);
result = result && IntIsZero(&parsed);
result = result && IntIsZero(&value);
IntDeinit(&parsed); bool result = !IntTryFromStr(&value, (Zstr)NULL);
result = result && IntIsZero(&parsed);
result = result && IntIsZero(&value);
result = result && IntIsZero(&parsed);
result = result && IntIsZero(&value);
IntDeinit(&parsed); bool result = !IntTryFromStrRadix(&value, (Zstr)NULL, 10);
result = result && IntIsZero(&parsed);
result = result && IntIsZero(&value);
result = result && IntIsZero(&parsed);
result = result && IntIsZero(&value);
IntDeinit(&parsed); bool result = !IntTryFromOctStr(&value, (Zstr)NULL);
result = result && IntIsZero(&parsed);
result = result && IntIsZero(&value);
result = result && IntIsZero(&parsed);
result = result && IntIsZero(&value);
IntDeinit(&parsed); bool result = !IntTryFromHexStr(&value, (Zstr)NULL);
result = result && IntIsZero(&parsed);
result = result && IntIsZero(&value);
result = result && IntIsZero(&parsed);
result = result && IntIsZero(&value);
IntDeinit(&parsed);- In
Int.Type.c:21:
Int value = IntInit(&alloc.base);
bool result = IntIsZero(&value);
result = result && (IntBitLength(&value) == 0);- In
Int.Type.c:38:
IntClear(&value);
bool result = IntIsZero(&value);
result = result && (IntBitLength(&value) == 0);- In
Int.Math.c:281:
IntMul(&result_value, &a, &b);
bool result = IntIsZero(&result_value);
result = result && (IntToU64(&result_value) == 0);
Last updated on