IntIsZero
IntIsZero
Description
Test whether the integer is zero.
Parameters
| Name | Direction | Description |
|---|---|---|
value |
in | Integer to test |
Usage example (from documentation)
if (IntIsZero(&value)) { /* ... */ }Returns
true when the integer is zero.
Usage example (Cross-references)
Usage examples (Cross-references)
- In
Float.c:134:
ValidateFloat(value);
if (IntIsZero(&value->significand)) {
value->negative = false;
value->exponent = 0;- In
Float.c:152:
bool FloatIsZero(Float *value) {
ValidateFloat(value);
return IntIsZero(&value->significand);
}- In
Float.c:331:
result.significand = IntFromStr(digits.data);
result.negative = negative && !IntIsZero(&result.significand);
result.exponent = float_sub_i64_checked(explicit_exp, fractional);- In
Int.c:93:
static void sint_normalize(SignedInt *value) {
int_normalize(&value->magnitude);
if (IntIsZero(&value->magnitude)) {
value->negative = false;
}- In
Int.c:136:
SignedInt neg_b = sint_clone(b);
if (!IntIsZero(&neg_b.magnitude)) {
neg_b.negative = !neg_b.negative;
}- In
Int.c:296:
ValidateInt(value);
if (IntIsZero(value)) {
LOG_FATAL("log2 undefined for zero");
}- In
Int.c:315:
}
bool IntIsZero(Int *value) {
return IntBitLength(value) == 0;
}- In
Int.c:340:
ValidateInt(value);
return !IntIsZero(value) && IntBitLength(value) == IntTrailingZeroCount(value) + 1;
}- In
Int.c:516:
int_validate_radix(radix);
if (IntIsZero(value)) {
return StrInitFromZstr("0");
}- In
Int.c:523:
Str result = StrInit();
while (!IntIsZero(¤t)) {
Int quotient = IntInit();
u64 digit = 0;- In
Int.c:824:
Int acc = IntInit();
if (IntIsZero(a) || IntIsZero(b)) {
IntDeinit(result);
*result = acc;- In
Int.c:934:
LOG_FATAL("quotient and remainder must be different objects");
}
if (IntIsZero(divisor)) {
LOG_FATAL("Division by zero");
}- In
Int.c:998:
ValidateInt(divisor);
if (IntIsZero(divisor)) {
LOG_FATAL("Division by zero");
}- In
Int.c:1006:
IntDivMod("ient, &remainder, dividend, divisor);
if (!IntIsZero(&remainder)) {
IntDeinit("ient);
IntDeinit(&remainder);- In
Int.c:1126:
Int y = IntClone(b);
while (!IntIsZero(&y)) {
Int r = IntInit();- In
Int.c:1144:
ValidateInt(b);
if (IntIsZero(a) || IntIsZero(b)) {
Int zero = IntInit();
int_replace(result, &zero);- In
Int.c:1175:
}
if (IntIsZero(value)) {
Int zero_root = IntInit();
Int zero_rem = IntInit();- In
Int.c:1232:
Int next = IntInit();
if (IntEQ(&mid, &one) || IntIsZero(&mid)) {
IntDeinit(&high);
high = IntInit();- In
Int.c:1288:
IntSqrtRem(&root, &remainder, value);
result = IntIsZero(&remainder);
IntDeinit(&root);- In
Int.c:1298:
ValidateInt(value);
if (IntIsZero(value) || IntBitLength(value) == 1) {
return true;
}- In
Int.c:1310:
IntRootRem(&root, &remainder, value, degree);
exact = IntIsZero(&remainder);
IntDeinit(&root);- In
Int.c:1327:
ValidateInt(n);
if (IntIsZero(n) || IntIsEven(n)) {
LOG_FATAL("n must be non-zero and odd");
}- In
Int.c:1337:
IntMod(&aa, a, &nn);
while (!IntIsZero(&aa)) {
while (IntIsEven(&aa)) {
u64 n_mod_8 = 0;- In
Int.c:1373:
ValidateInt(modulus);
if (IntIsZero(modulus)) {
LOG_FATAL("modulus is zero");
}- In
Int.c:1397:
ValidateInt(modulus);
if (IntIsZero(modulus)) {
LOG_FATAL("modulus is zero");
}- In
Int.c:1413:
(void)IntSub(&diff, &br, &ar);
if (IntIsZero(&diff)) {
Int zero = IntInit();
int_replace(result, &zero);- In
Int.c:1433:
ValidateInt(modulus);
if (IntIsZero(modulus)) {
LOG_FATAL("modulus is zero");
}- In
Int.c:1457:
ValidateInt(modulus);
if (IntIsZero(modulus)) {
LOG_FATAL("modulus is zero");
}- In
Int.c:1488:
ValidateInt(modulus);
if (IntIsZero(modulus)) {
LOG_FATAL("modulus is zero");
}- In
Int.c:1527:
ValidateInt(modulus);
if (IntIsZero(modulus)) {
LOG_FATAL("modulus is zero");
}- In
Int.c:1538:
IntMod(&base_mod, base, modulus);
while (!IntIsZero(&exp)) {
if (int_is_odd(&exp)) {
Int next = IntInit();- In
Int.c:1548:
IntShiftRight(&exp, 1);
if (!IntIsZero(&exp)) {
Int next = IntInit();- In
Int.c:1575:
ValidateInt(modulus);
if (IntIsZero(modulus)) {
LOG_FATAL("modulus is zero");
}- In
Int.c:1590:
new_r = IntClone(&reduced);
while (!IntIsZero(&new_r)) {
Int q = IntInit();
Int rem = IntInit();- In
Int.c:1621:
IntMod(&mag_mod, &t.magnitude, modulus);
if (t.negative && !IntIsZero(&mag_mod)) {
(void)IntSub(&positive, modulus, &mag_mod);
} else {- In
Int.c:1646:
ValidateInt(modulus);
if (IntIsZero(modulus)) {
LOG_FATAL("modulus is zero");
}- In
Int.c:1655:
IntMod(&a, value, modulus);
if (IntIsZero(&a)) {
Int zero = IntInit();
int_replace(result, &zero);
bool result = IntBitLength(&zero) == 0;
result = result && IntIsZero(&zero);
result = result && (IntToU64(&zero) == 0);
result = result && (strcmp(text.data, "0") == 0);- In
Int.Access.c:41:
bool test_int_is_zero(void) {
WriteFmt("Testing IntIsZero\n");
Int zero = IntInit();- In
Int.Access.c:46:
Int non_zero = IntFrom(1);
bool result = IntIsZero(&zero);
result = result && !IntIsZero(&non_zero);- In
Int.Access.c:47:
bool result = IntIsZero(&zero);
result = result && !IntIsZero(&non_zero);
IntDeinit(&zero);- In
Int.Math.c:251:
IntMul(&result_value, &a, &b);
bool result = IntIsZero(&result_value);
result = result && (IntToU64(&result_value) == 0);- In
Int.Type.c:16:
Int value = IntInit();
bool result = IntIsZero(&value);
result = result && (IntBitLength(&value) == 0);- In
Int.Type.c:30:
IntClear(&value);
bool result = IntIsZero(&value);
result = result && (IntBitLength(&value) == 0);
Last updated on