mirror of https://github.com/RT-Thread/rt-thread
[FIXUP] __rt_clz loss in aarch64
Signed-off-by: GuEe-GUI <2991707448@qq.com>
This commit is contained in:
parent
ec4f375bbc
commit
78f318aa8f
|
@ -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 */
|
||||
|
|
Loading…
Reference in New Issue