blob: 8969a97d54ef3716c0055556e3d1cb76ba9d226a [file] [log] [blame]
// Copyright Microsoft and CHERIoT Contributors.
// SPDX-License-Identifier: MIT
#include <cdefs.h>
#include <stddef.h>
#include <stdint.h>
size_t __noinline __cheri_libcall clz(uint32_t x)
{
return __builtin_clz(x);
}
size_t __noinline __cheri_libcall ctz(uint32_t x)
{
x &= -x;
return 32U - (clz(x) + 1);
}