IntTrailingZeroCount
Description
Number of trailing zero bits (equivalent to the largest power of two that divides the value).
Parameters
| Name | Direction | Description |
|---|---|---|
value |
in | Integer to inspect. |
Success
Returns the trailing-zero count as a u64. Returns 0 when value is zero. The integer is not modified.
Failure
Function cannot fail.
Usage example (Cross-references)
Usage examples (Cross-references)
- In
Int.c:401:
}
u64 IntTrailingZeroCount(const Int *value) {
ValidateInt(value);- In
Int.c:438:
ValidateInt(value);
return !IntIsZero(value) && IntBitLength(value) == IntTrailingZeroCount(value) + 1;
}- In
Int.Access.c:136:
bool test_int_trailing_zero_count(void) {
WriteFmt("Testing IntTrailingZeroCount\n");
DefaultAllocator alloc = DefaultAllocatorInit();- In
Int.Access.c:143:
Int zero = IntInit(&alloc.base);
bool result = IntTrailingZeroCount(&value) == 4;
result = result && (IntTrailingZeroCount(&zero) == 0);- In
Int.Access.c:144:
bool result = IntTrailingZeroCount(&value) == 4;
result = result && (IntTrailingZeroCount(&zero) == 0);
IntDeinit(&value);
Last updated on