[FIXUP] __rt_clz loss in aarch64

Signed-off-by: GuEe-GUI <2991707448@qq.com>
This commit is contained in:
GuEe-GUI 2024-12-12 13:52:49 +08:00 committed by Rbb666
parent ec4f375bbc
commit 78f318aa8f
2 changed files with 16 additions and 0 deletions

View File

@ -794,6 +794,7 @@ rt_device_t rt_console_get_device(void);
int __rt_ffs(int value);
unsigned long __rt_ffsl(unsigned long value);
unsigned long __rt_clz(unsigned long value);
void rt_show_version(void);

View File

@ -56,4 +56,19 @@ unsigned long __rt_ffsl(unsigned long value)
#endif
}
unsigned long __rt_clz(unsigned long value)
{
#ifdef __GNUC__
return __builtin_clz(value);
#else
unsigned long val;
__asm__ volatile ("clz %0, %1"
:"=r"(val)
:"r"(value));
return val;
#endif
}
#endif /* RT_USING_CPU_FFS */