mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2026-10-02 14:23:19 +08:00
[FIXUP] __rt_clz loss in aarch64
Signed-off-by: GuEe-GUI <2991707448@qq.com>
This commit is contained in:
@@ -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);
|
||||
|
||||
|
||||
@@ -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 */
|
||||
|
||||
Reference in New Issue
Block a user