From 4926cc21d9ac9ff9d0769db6542eabb294dcbb9b Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Sat, 3 Jan 2009 16:14:05 +1030 Subject: [PATCH] --- yaml --- r: 125711 b: refs/heads/master c: ee38e5140bafbf40e1bd25ab917ac8db54a27799 h: refs/heads/master i: 125709: 845f1a61f4dd6497e40b52a41f2e9dd54c613085 125707: af3ad692800c4353c59b2156140f062784365cd6 125703: 53da3b85b71043ae31fddb7c70c0ad7324144981 125695: 66381b6b47588931d24caa9be4d080c10f9143c1 v: v3 --- [refs] | 2 +- trunk/include/asm-frv/bitops.h | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/[refs] b/[refs] index f2914b0f1cf0..d3fcb16588a7 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 0999769e6cad9b0e5abb7c513c0c3f16821f0884 +refs/heads/master: ee38e5140bafbf40e1bd25ab917ac8db54a27799 diff --git a/trunk/include/asm-frv/bitops.h b/trunk/include/asm-frv/bitops.h index 39456ba0ec17..287f6f697ce2 100644 --- a/trunk/include/asm-frv/bitops.h +++ b/trunk/include/asm-frv/bitops.h @@ -339,6 +339,19 @@ int __ffs(unsigned long x) return 31 - bit; } +/** + * __fls - find last (most-significant) set bit in a long word + * @word: the word to search + * + * Undefined if no set bit exists, so code should check against 0 first. + */ +static inline unsigned long __fls(unsigned long word) +{ + unsigned long bit; + asm("scan %1,gr0,%0" : "=r"(bit) : "r"(word)); + return bit; +} + /* * special slimline version of fls() for calculating ilog2_u32() * - note: no protection against n == 0