IntFitsU64
IntFitsU64
Description
Test whether the integer can be losslessly converted to u64.
Parameters
| Name | Direction | Description |
|---|---|---|
value |
in | Integer to test |
Usage example (from documentation)
if (IntFitsU64(&value)) { /* safe to call IntToU64 */ }Returns
true when the value fits in 64 unsigned bits.
Usage example (Cross-references)
Usage examples (Cross-references)
- In
Int.c:332:
}
bool IntFitsU64(Int *value) {
ValidateInt(value);
return IntBitLength(value) <= 64;- In
Int.c:372:
ValidateInt(value);
if (!IntFitsU64(value)) {
LOG_FATAL("Int value exceeds u64 range");
}- In
Int.c:880:
ValidateInt(exponent);
if (!IntFitsU64(exponent)) {
LOG_FATAL("Int exponent exceeds u64 range");
}- In
Int.Access.c:85:
bool test_int_fits_u64(void) {
WriteFmt("Testing IntFitsU64\n");
Int small = IntFrom(UINT64_MAX);- In
Int.Access.c:92:
IntShiftLeft(&big, 64);
bool result = IntFitsU64(&small);
result = result && !IntFitsU64(&big);- In
Int.Access.c:93:
bool result = IntFitsU64(&small);
result = result && !IntFitsU64(&big);
IntDeinit(&small);
Last updated on