summaryrefslogtreecommitdiff
path: root/libcpu
diff options
context:
space:
mode:
authorMeco Jianting Man <[email protected]>2021-03-03 10:46:17 -0600
committerGitHub <[email protected]>2021-03-03 10:46:17 -0600
commit034046c32ecf8e94f36fc25eb35ec78f6e549da1 (patch)
treed99d68d92e76f6b9df8d841462086a107317cb41 /libcpu
parentfab4c5ebb13fd92273de8727c0f18d53716295ff (diff)
parent4a40ba95358139aed460369a91ff995cad2f8ce5 (diff)
Merge pull request #23 from RT-Thread/master
pr
Diffstat (limited to 'libcpu')
-rw-r--r--libcpu/arm/cortex-m33/cpuport.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/libcpu/arm/cortex-m33/cpuport.c b/libcpu/arm/cortex-m33/cpuport.c
index 42b5798507..41325105d7 100644
--- a/libcpu/arm/cortex-m33/cpuport.c
+++ b/libcpu/arm/cortex-m33/cpuport.c
@@ -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)
);