diff options
| -rw-r--r-- | include/asm-alpha/bitops.h | 1 | ||||
| -rw-r--r-- | include/asm-arm/bitops.h | 2 | ||||
| -rw-r--r-- | include/asm-arm26/bitops.h | 1 | ||||
| -rw-r--r-- | include/asm-cris/bitops.h | 1 | ||||
| -rw-r--r-- | include/asm-frv/bitops.h | 1 | ||||
| -rw-r--r-- | include/asm-generic/bitops.h | 1 | ||||
| -rw-r--r-- | include/asm-h8300/bitops.h | 1 | ||||
| -rw-r--r-- | include/asm-i386/bitops.h | 1 | ||||
| -rw-r--r-- | include/asm-ia64/bitops.h | 1 | ||||
| -rw-r--r-- | include/asm-m32r/bitops.h | 1 | ||||
| -rw-r--r-- | include/asm-m68k/bitops.h | 1 | ||||
| -rw-r--r-- | include/asm-m68knommu/bitops.h | 1 | ||||
| -rw-r--r-- | include/asm-mips/bitops.h | 2 | ||||
| -rw-r--r-- | include/asm-parisc/bitops.h | 1 | ||||
| -rw-r--r-- | include/asm-powerpc/bitops.h | 1 | ||||
| -rw-r--r-- | include/asm-s390/bitops.h | 1 | ||||
| -rw-r--r-- | include/asm-sh/bitops.h | 1 | ||||
| -rw-r--r-- | include/asm-sh64/bitops.h | 1 | ||||
| -rw-r--r-- | include/asm-sparc/bitops.h | 1 | ||||
| -rw-r--r-- | include/asm-sparc64/bitops.h | 1 | ||||
| -rw-r--r-- | include/asm-v850/bitops.h | 1 | ||||
| -rw-r--r-- | include/asm-x86_64/bitops.h | 1 | ||||
| -rw-r--r-- | include/asm-xtensa/bitops.h | 1 | ||||
| -rw-r--r-- | include/linux/bitops.h | 9 |
24 files changed, 33 insertions, 1 deletions
diff --git a/include/asm-alpha/bitops.h b/include/asm-alpha/bitops.h index 578ed3f1a607..302201f1a097 100644 --- a/include/asm-alpha/bitops.h +++ b/include/asm-alpha/bitops.h | |||
| @@ -321,6 +321,7 @@ static inline int fls(int word) | |||
| 321 | #else | 321 | #else |
| 322 | #define fls generic_fls | 322 | #define fls generic_fls |
| 323 | #endif | 323 | #endif |
| 324 | #define fls64 generic_fls64 | ||
| 324 | 325 | ||
| 325 | /* Compute powers of two for the given integer. */ | 326 | /* Compute powers of two for the given integer. */ |
| 326 | static inline long floor_log2(unsigned long word) | 327 | static inline long floor_log2(unsigned long word) |
diff --git a/include/asm-arm/bitops.h b/include/asm-arm/bitops.h index 7399d431edfe..d02de721ecc1 100644 --- a/include/asm-arm/bitops.h +++ b/include/asm-arm/bitops.h | |||
| @@ -332,6 +332,7 @@ static inline unsigned long __ffs(unsigned long word) | |||
| 332 | */ | 332 | */ |
| 333 | 333 | ||
| 334 | #define fls(x) generic_fls(x) | 334 | #define fls(x) generic_fls(x) |
| 335 | #define fls64(x) generic_fls64(x) | ||
| 335 | 336 | ||
| 336 | /* | 337 | /* |
| 337 | * ffs: find first bit set. This is defined the same way as | 338 | * ffs: find first bit set. This is defined the same way as |
| @@ -351,6 +352,7 @@ static inline unsigned long __ffs(unsigned long word) | |||
| 351 | #define fls(x) \ | 352 | #define fls(x) \ |
| 352 | ( __builtin_constant_p(x) ? generic_fls(x) : \ | 353 | ( __builtin_constant_p(x) ? generic_fls(x) : \ |
| 353 | ({ int __r; asm("clz\t%0, %1" : "=r"(__r) : "r"(x) : "cc"); 32-__r; }) ) | 354 | ({ int __r; asm("clz\t%0, %1" : "=r"(__r) : "r"(x) : "cc"); 32-__r; }) ) |
| 355 | #define fls64(x) generic_fls64(x) | ||
| 354 | #define ffs(x) ({ unsigned long __t = (x); fls(__t & -__t); }) | 356 | #define ffs(x) ({ unsigned long __t = (x); fls(__t & -__t); }) |
| 355 | #define __ffs(x) (ffs(x) - 1) | 357 | #define __ffs(x) (ffs(x) - 1) |
| 356 | #define ffz(x) __ffs( ~(x) ) | 358 | #define ffz(x) __ffs( ~(x) ) |
diff --git a/include/asm-arm26/bitops.h b/include/asm-arm26/bitops.h index 7d062fb2e343..15cc6f2da792 100644 --- a/include/asm-arm26/bitops.h +++ b/include/asm-arm26/bitops.h | |||
| @@ -259,6 +259,7 @@ static inline unsigned long __ffs(unsigned long word) | |||
| 259 | */ | 259 | */ |
| 260 | 260 | ||
| 261 | #define fls(x) generic_fls(x) | 261 | #define fls(x) generic_fls(x) |
| 262 | #define fls64(x) generic_fls64(x) | ||
| 262 | 263 | ||
| 263 | /* | 264 | /* |
| 264 | * ffs: find first bit set. This is defined the same way as | 265 | * ffs: find first bit set. This is defined the same way as |
diff --git a/include/asm-cris/bitops.h b/include/asm-cris/bitops.h index 1bddb3f3a289..d3eb0f1e4208 100644 --- a/include/asm-cris/bitops.h +++ b/include/asm-cris/bitops.h | |||
| @@ -240,6 +240,7 @@ static inline int test_bit(int nr, const volatile unsigned long *addr) | |||
| 240 | */ | 240 | */ |
| 241 | 241 | ||
| 242 | #define fls(x) generic_fls(x) | 242 | #define fls(x) generic_fls(x) |
| 243 | #define fls64(x) generic_fls64(x) | ||
| 243 | 244 | ||
| 244 | /* | 245 | /* |
| 245 | * hweightN - returns the hamming weight of a N-bit word | 246 | * hweightN - returns the hamming weight of a N-bit word |
diff --git a/include/asm-frv/bitops.h b/include/asm-frv/bitops.h index b664bd5b6663..02be7b3a8a83 100644 --- a/include/asm-frv/bitops.h +++ b/include/asm-frv/bitops.h | |||
| @@ -228,6 +228,7 @@ found_middle: | |||
| 228 | \ | 228 | \ |
| 229 | bit ? 33 - bit : bit; \ | 229 | bit ? 33 - bit : bit; \ |
| 230 | }) | 230 | }) |
| 231 | #define fls64(x) generic_fls64(x) | ||
| 231 | 232 | ||
| 232 | /* | 233 | /* |
| 233 | * Every architecture must define this function. It's the fastest | 234 | * Every architecture must define this function. It's the fastest |
diff --git a/include/asm-generic/bitops.h b/include/asm-generic/bitops.h index ce31b739fd80..0e6d9852008c 100644 --- a/include/asm-generic/bitops.h +++ b/include/asm-generic/bitops.h | |||
| @@ -56,6 +56,7 @@ extern __inline__ int test_bit(int nr, const unsigned long * addr) | |||
| 56 | */ | 56 | */ |
| 57 | 57 | ||
| 58 | #define fls(x) generic_fls(x) | 58 | #define fls(x) generic_fls(x) |
| 59 | #define fls64(x) generic_fls64(x) | ||
| 59 | 60 | ||
| 60 | #ifdef __KERNEL__ | 61 | #ifdef __KERNEL__ |
| 61 | 62 | ||
diff --git a/include/asm-h8300/bitops.h b/include/asm-h8300/bitops.h index 5036f595f8c9..c0411ec9d651 100644 --- a/include/asm-h8300/bitops.h +++ b/include/asm-h8300/bitops.h | |||
| @@ -406,5 +406,6 @@ found_middle: | |||
| 406 | #endif /* __KERNEL__ */ | 406 | #endif /* __KERNEL__ */ |
| 407 | 407 | ||
| 408 | #define fls(x) generic_fls(x) | 408 | #define fls(x) generic_fls(x) |
| 409 | #define fls64(x) generic_fls64(x) | ||
| 409 | 410 | ||
| 410 | #endif /* _H8300_BITOPS_H */ | 411 | #endif /* _H8300_BITOPS_H */ |
diff --git a/include/asm-i386/bitops.h b/include/asm-i386/bitops.h index ddf1739dc7fd..4807aa1d2e3d 100644 --- a/include/asm-i386/bitops.h +++ b/include/asm-i386/bitops.h | |||
| @@ -372,6 +372,7 @@ static inline unsigned long ffz(unsigned long word) | |||
| 372 | */ | 372 | */ |
| 373 | 373 | ||
| 374 | #define fls(x) generic_fls(x) | 374 | #define fls(x) generic_fls(x) |
| 375 | #define fls64(x) generic_fls64(x) | ||
| 375 | 376 | ||
| 376 | #ifdef __KERNEL__ | 377 | #ifdef __KERNEL__ |
| 377 | 378 | ||
diff --git a/include/asm-ia64/bitops.h b/include/asm-ia64/bitops.h index 7232528e2d0c..36d0fb95ea89 100644 --- a/include/asm-ia64/bitops.h +++ b/include/asm-ia64/bitops.h | |||
| @@ -345,6 +345,7 @@ fls (int t) | |||
| 345 | x |= x >> 16; | 345 | x |= x >> 16; |
| 346 | return ia64_popcnt(x); | 346 | return ia64_popcnt(x); |
| 347 | } | 347 | } |
| 348 | #define fls64(x) generic_fls64(x) | ||
| 348 | 349 | ||
| 349 | /* | 350 | /* |
| 350 | * ffs: find first bit set. This is defined the same way as the libc and compiler builtin | 351 | * ffs: find first bit set. This is defined the same way as the libc and compiler builtin |
diff --git a/include/asm-m32r/bitops.h b/include/asm-m32r/bitops.h index e78443981349..abea2fdd8689 100644 --- a/include/asm-m32r/bitops.h +++ b/include/asm-m32r/bitops.h | |||
| @@ -465,6 +465,7 @@ static __inline__ unsigned long __ffs(unsigned long word) | |||
| 465 | * fls: find last bit set. | 465 | * fls: find last bit set. |
| 466 | */ | 466 | */ |
| 467 | #define fls(x) generic_fls(x) | 467 | #define fls(x) generic_fls(x) |
| 468 | #define fls64(x) generic_fls64(x) | ||
| 468 | 469 | ||
| 469 | #ifdef __KERNEL__ | 470 | #ifdef __KERNEL__ |
| 470 | 471 | ||
diff --git a/include/asm-m68k/bitops.h b/include/asm-m68k/bitops.h index b1bcf7c66516..13f4c0048463 100644 --- a/include/asm-m68k/bitops.h +++ b/include/asm-m68k/bitops.h | |||
| @@ -310,6 +310,7 @@ static inline int fls(int x) | |||
| 310 | 310 | ||
| 311 | return 32 - cnt; | 311 | return 32 - cnt; |
| 312 | } | 312 | } |
| 313 | #define fls64(x) generic_fls64(x) | ||
| 313 | 314 | ||
| 314 | /* | 315 | /* |
| 315 | * Every architecture must define this function. It's the fastest | 316 | * Every architecture must define this function. It's the fastest |
diff --git a/include/asm-m68knommu/bitops.h b/include/asm-m68knommu/bitops.h index c42f88a9b9f9..4058dd086a02 100644 --- a/include/asm-m68knommu/bitops.h +++ b/include/asm-m68knommu/bitops.h | |||
| @@ -499,5 +499,6 @@ found_middle: | |||
| 499 | * fls: find last bit set. | 499 | * fls: find last bit set. |
| 500 | */ | 500 | */ |
| 501 | #define fls(x) generic_fls(x) | 501 | #define fls(x) generic_fls(x) |
| 502 | #define fls64(x) generic_fls64(x) | ||
| 502 | 503 | ||
| 503 | #endif /* _M68KNOMMU_BITOPS_H */ | 504 | #endif /* _M68KNOMMU_BITOPS_H */ |
diff --git a/include/asm-mips/bitops.h b/include/asm-mips/bitops.h index 5496f9064a6a..3b0c8aaf6e8b 100644 --- a/include/asm-mips/bitops.h +++ b/include/asm-mips/bitops.h | |||
| @@ -695,7 +695,7 @@ static inline unsigned long fls(unsigned long word) | |||
| 695 | 695 | ||
| 696 | return flz(~word) + 1; | 696 | return flz(~word) + 1; |
| 697 | } | 697 | } |
| 698 | 698 | #define fls64(x) generic_fls64(x) | |
| 699 | 699 | ||
| 700 | /* | 700 | /* |
| 701 | * find_next_zero_bit - find the first zero bit in a memory region | 701 | * find_next_zero_bit - find the first zero bit in a memory region |
diff --git a/include/asm-parisc/bitops.h b/include/asm-parisc/bitops.h index 55b98c67fd82..15d8c2b51584 100644 --- a/include/asm-parisc/bitops.h +++ b/include/asm-parisc/bitops.h | |||
| @@ -263,6 +263,7 @@ static __inline__ int fls(int x) | |||
| 263 | 263 | ||
| 264 | return ret; | 264 | return ret; |
| 265 | } | 265 | } |
| 266 | #define fls64(x) generic_fls64(x) | ||
| 266 | 267 | ||
| 267 | /* | 268 | /* |
| 268 | * hweightN: returns the hamming weight (i.e. the number | 269 | * hweightN: returns the hamming weight (i.e. the number |
diff --git a/include/asm-powerpc/bitops.h b/include/asm-powerpc/bitops.h index 5727229b0444..1996eaa8aeae 100644 --- a/include/asm-powerpc/bitops.h +++ b/include/asm-powerpc/bitops.h | |||
| @@ -310,6 +310,7 @@ static __inline__ int fls(unsigned int x) | |||
| 310 | asm ("cntlzw %0,%1" : "=r" (lz) : "r" (x)); | 310 | asm ("cntlzw %0,%1" : "=r" (lz) : "r" (x)); |
| 311 | return 32 - lz; | 311 | return 32 - lz; |
| 312 | } | 312 | } |
| 313 | #define fls64(x) generic_fls64(x) | ||
| 313 | 314 | ||
| 314 | /* | 315 | /* |
| 315 | * hweightN: returns the hamming weight (i.e. the number | 316 | * hweightN: returns the hamming weight (i.e. the number |
diff --git a/include/asm-s390/bitops.h b/include/asm-s390/bitops.h index b07c578b22ea..61232760cc3b 100644 --- a/include/asm-s390/bitops.h +++ b/include/asm-s390/bitops.h | |||
| @@ -839,6 +839,7 @@ static inline int sched_find_first_bit(unsigned long *b) | |||
| 839 | * fls: find last bit set. | 839 | * fls: find last bit set. |
| 840 | */ | 840 | */ |
| 841 | #define fls(x) generic_fls(x) | 841 | #define fls(x) generic_fls(x) |
| 842 | #define fls64(x) generic_fls64(x) | ||
| 842 | 843 | ||
| 843 | /* | 844 | /* |
| 844 | * hweightN: returns the hamming weight (i.e. the number | 845 | * hweightN: returns the hamming weight (i.e. the number |
diff --git a/include/asm-sh/bitops.h b/include/asm-sh/bitops.h index 5163d1ff2f1b..1c5260860045 100644 --- a/include/asm-sh/bitops.h +++ b/include/asm-sh/bitops.h | |||
| @@ -470,6 +470,7 @@ found_middle: | |||
| 470 | */ | 470 | */ |
| 471 | 471 | ||
| 472 | #define fls(x) generic_fls(x) | 472 | #define fls(x) generic_fls(x) |
| 473 | #define fls64(x) generic_fls64(x) | ||
| 473 | 474 | ||
| 474 | #endif /* __KERNEL__ */ | 475 | #endif /* __KERNEL__ */ |
| 475 | 476 | ||
diff --git a/include/asm-sh64/bitops.h b/include/asm-sh64/bitops.h index e1ff63e09227..ce9c3ad45fe0 100644 --- a/include/asm-sh64/bitops.h +++ b/include/asm-sh64/bitops.h | |||
| @@ -510,6 +510,7 @@ found_middle: | |||
| 510 | 510 | ||
| 511 | #define ffs(x) generic_ffs(x) | 511 | #define ffs(x) generic_ffs(x) |
| 512 | #define fls(x) generic_fls(x) | 512 | #define fls(x) generic_fls(x) |
| 513 | #define fls64(x) generic_fls64(x) | ||
| 513 | 514 | ||
| 514 | #endif /* __KERNEL__ */ | 515 | #endif /* __KERNEL__ */ |
| 515 | 516 | ||
diff --git a/include/asm-sparc/bitops.h b/include/asm-sparc/bitops.h index bfbd795a0a80..41722b5e45ef 100644 --- a/include/asm-sparc/bitops.h +++ b/include/asm-sparc/bitops.h | |||
| @@ -298,6 +298,7 @@ static inline int ffs(int x) | |||
| 298 | * Note fls(0) = 0, fls(1) = 1, fls(0x80000000) = 32. | 298 | * Note fls(0) = 0, fls(1) = 1, fls(0x80000000) = 32. |
| 299 | */ | 299 | */ |
| 300 | #define fls(x) generic_fls(x) | 300 | #define fls(x) generic_fls(x) |
| 301 | #define fls64(x) generic_fls64(x) | ||
| 301 | 302 | ||
| 302 | /* | 303 | /* |
| 303 | * hweightN: returns the hamming weight (i.e. the number | 304 | * hweightN: returns the hamming weight (i.e. the number |
diff --git a/include/asm-sparc64/bitops.h b/include/asm-sparc64/bitops.h index 6388b8376c50..6efc0162fb09 100644 --- a/include/asm-sparc64/bitops.h +++ b/include/asm-sparc64/bitops.h | |||
| @@ -119,6 +119,7 @@ static inline unsigned long __ffs(unsigned long word) | |||
| 119 | */ | 119 | */ |
| 120 | 120 | ||
| 121 | #define fls(x) generic_fls(x) | 121 | #define fls(x) generic_fls(x) |
| 122 | #define fls64(x) generic_fls64(x) | ||
| 122 | 123 | ||
| 123 | #ifdef __KERNEL__ | 124 | #ifdef __KERNEL__ |
| 124 | 125 | ||
diff --git a/include/asm-v850/bitops.h b/include/asm-v850/bitops.h index b91e799763fd..8955d2376ac8 100644 --- a/include/asm-v850/bitops.h +++ b/include/asm-v850/bitops.h | |||
| @@ -276,6 +276,7 @@ found_middle: | |||
| 276 | 276 | ||
| 277 | #define ffs(x) generic_ffs (x) | 277 | #define ffs(x) generic_ffs (x) |
| 278 | #define fls(x) generic_fls (x) | 278 | #define fls(x) generic_fls (x) |
| 279 | #define fls64(x) generic_fls64(x) | ||
| 279 | #define __ffs(x) ffs(x) | 280 | #define __ffs(x) ffs(x) |
| 280 | 281 | ||
| 281 | 282 | ||
diff --git a/include/asm-x86_64/bitops.h b/include/asm-x86_64/bitops.h index 05a0d374404b..94b52c8ce97f 100644 --- a/include/asm-x86_64/bitops.h +++ b/include/asm-x86_64/bitops.h | |||
| @@ -409,6 +409,7 @@ static __inline__ int ffs(int x) | |||
| 409 | 409 | ||
| 410 | /* find last set bit */ | 410 | /* find last set bit */ |
| 411 | #define fls(x) generic_fls(x) | 411 | #define fls(x) generic_fls(x) |
| 412 | #define fls64(x) generic_fls64(x) | ||
| 412 | 413 | ||
| 413 | #endif /* __KERNEL__ */ | 414 | #endif /* __KERNEL__ */ |
| 414 | 415 | ||
diff --git a/include/asm-xtensa/bitops.h b/include/asm-xtensa/bitops.h index e76ee889e21d..0a2065f1a372 100644 --- a/include/asm-xtensa/bitops.h +++ b/include/asm-xtensa/bitops.h | |||
| @@ -245,6 +245,7 @@ static __inline__ int fls (unsigned int x) | |||
| 245 | { | 245 | { |
| 246 | return __cntlz(x); | 246 | return __cntlz(x); |
| 247 | } | 247 | } |
| 248 | #define fls64(x) generic_fls64(x) | ||
| 248 | 249 | ||
| 249 | static __inline__ int | 250 | static __inline__ int |
| 250 | find_next_bit(const unsigned long *addr, int size, int offset) | 251 | find_next_bit(const unsigned long *addr, int size, int offset) |
diff --git a/include/linux/bitops.h b/include/linux/bitops.h index 38c2fb7ebe09..6a2a19f14bb2 100644 --- a/include/linux/bitops.h +++ b/include/linux/bitops.h | |||
| @@ -76,6 +76,15 @@ static __inline__ int generic_fls(int x) | |||
| 76 | */ | 76 | */ |
| 77 | #include <asm/bitops.h> | 77 | #include <asm/bitops.h> |
| 78 | 78 | ||
| 79 | |||
| 80 | static inline int generic_fls64(__u64 x) | ||
| 81 | { | ||
| 82 | __u32 h = x >> 32; | ||
| 83 | if (h) | ||
| 84 | return fls(x) + 32; | ||
| 85 | return fls(x); | ||
| 86 | } | ||
| 87 | |||
| 79 | static __inline__ int get_bitmask_order(unsigned int count) | 88 | static __inline__ int get_bitmask_order(unsigned int count) |
| 80 | { | 89 | { |
| 81 | int order; | 90 | int order; |
