mirror of
https://gitlab.com/sortix/sortix.git
synced 2023-02-13 20:55:38 -05:00
Optimize is_power_of_two.
This commit is contained in:
parent
5585303365
commit
4890297611
1 changed files with 1 additions and 4 deletions
|
@ -44,10 +44,7 @@ namespace ELF {
|
||||||
|
|
||||||
static bool is_power_of_two(uintptr_t value)
|
static bool is_power_of_two(uintptr_t value)
|
||||||
{
|
{
|
||||||
for ( uintptr_t i = 0; i < sizeof(uintptr_t) * 8; i++ )
|
return value && !(value & (value - 1));
|
||||||
if ( (uintptr_t) 1 << i == value )
|
|
||||||
return true;
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
uintptr_t Load(const void* file_ptr, size_t file_size, Auxiliary* aux)
|
uintptr_t Load(const void* file_ptr, size_t file_size, Auxiliary* aux)
|
||||||
|
|
Loading…
Reference in a new issue