diff options
Diffstat (limited to 'core/cortex-m0/__builtin.c')
-rw-r--r-- | core/cortex-m0/__builtin.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/core/cortex-m0/__builtin.c b/core/cortex-m0/__builtin.c new file mode 100644 index 0000000000..4bf495a011 --- /dev/null +++ b/core/cortex-m0/__builtin.c @@ -0,0 +1,16 @@ +/* Copyright 2019 The Chromium OS Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +#include "common.h" + +/* + * __builtin_ffs: + * Returns one plus the index of the least significant 1-bit of x, + * or if x is zero, returns zero. + */ +int __keep __ffssi2(int x) +{ + return 32 - __builtin_clz(x & -x); +} |