[libcpu][cm33] 修复不同优化等级,函数行为不一致的问题

This commit is contained in:
tangyuxin 2021-02-01 21:01:14 +08:00
parent ef8b984fa1
commit 360d7e48ab
1 changed files with 2 additions and 6 deletions

View File

@ -473,17 +473,13 @@ exit
#elif defined(__CLANG_ARM)
int __rt_ffs(int value)
{
__asm volatile(
"CMP r0, #0x00 \n"
"BEQ 1f \n"
if (value == 0) return value;
__asm volatile(
"RBIT r0, r0 \n"
"CLZ r0, r0 \n"
"ADDS r0, r0, #0x01 \n"
"1: \n"
"BX lr \n"
: "=r"(value)
: "r"(value)
);