Ring1_Intrinsic_isPowerOfTwo
Get if a value is a power of two.
Ring1_Result
Ring1_Intrinsic_isPowerOfTwo_suffix
(
type *result,
type *x
)
The following table denotes the valid combinations of suffix and type
suffix |
type |
u8 |
uint8_t |
u16 |
uint16_t |
u32 |
uint32_t |
u64 |
uint64_t |
s8 |
int8_t |
s16 |
int16_t |
s32 |
int32_t |
s64 |
int64_t |
sz |
size_t |
Parameter variables
result
- A pointer to an
bool
variable. result
- The value.
Return Values
Ring1_Result_Success
on success,
Ring1_Result_Failure
on failure.
Post Conditions
If this function fails, then it sets the by-thread status variable.
Below is a list of failure conditions and the status codes indicating them.
Ring1_Status_InvalidArgument
y
was0
.
If this function fails, result
is not dereferenced.
If this function succeeds, *result
is assigned true
if x
is a power of two and is assigned false
otherwise.
Remarks
In particular, this function considers 0
not as a power of two.