mtd: nand: print out the right information for JEDEC compliant NAND
[linux/fpc-iii.git] / lib / clz_ctz.c
bloba8f8379eb49f72800e45df0878bd54b0057eaa68
1 /*
2 * lib/clz_ctz.c
4 * Copyright (C) 2013 Chanho Min <chanho.min@lge.com>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
10 * __c[lt]z[sd]i2 can be overridden by linking arch-specific versions.
13 #include <linux/export.h>
14 #include <linux/kernel.h>
16 int __weak __ctzsi2(int val)
18 return __ffs(val);
20 EXPORT_SYMBOL(__ctzsi2);
22 int __weak __clzsi2(int val)
24 return 32 - fls(val);
26 EXPORT_SYMBOL(__clzsi2);
28 #if BITS_PER_LONG == 32
30 int __weak __clzdi2(long val)
32 return 32 - fls((int)val);
34 EXPORT_SYMBOL(__clzdi2);
36 int __weak __ctzdi2(long val)
38 return __ffs((u32)val);
40 EXPORT_SYMBOL(__ctzdi2);
42 #elif BITS_PER_LONG == 64
44 int __weak __clzdi2(long val)
46 return 64 - fls64((u64)val);
48 EXPORT_SYMBOL(__clzdi2);
50 int __weak __ctzdi2(long val)
52 return __ffs64((u64)val);
54 EXPORT_SYMBOL(__ctzdi2);
56 #else
57 #error BITS_PER_LONG not 32 or 64
58 #endif