hc
2024-05-10 37f49e37ab4cb5d0bc4c60eb5c6d4dd57db767bb
kernel/lib/clz_ctz.c
....@@ -1,11 +1,9 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * lib/clz_ctz.c
34 *
45 * Copyright (C) 2013 Chanho Min <chanho.min@lge.com>
56 *
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.
97 * The functions in this file aren't called directly, but are required by
108 * GCC builtins such as __builtin_ctz, and therefore they can't be removed
119 * despite appearing unreferenced in kernel source.
....@@ -30,36 +28,16 @@
3028 }
3129 EXPORT_SYMBOL(__clzsi2);
3230
33
-int __weak __clzdi2(long val);
34
-int __weak __ctzdi2(long val);
35
-#if BITS_PER_LONG == 32
36
-
37
-int __weak __clzdi2(long val)
31
+int __weak __clzdi2(u64 val);
32
+int __weak __clzdi2(u64 val)
3833 {
39
- return 32 - fls((int)val);
34
+ return 64 - fls64(val);
4035 }
4136 EXPORT_SYMBOL(__clzdi2);
4237
43
-int __weak __ctzdi2(long val)
38
+int __weak __ctzdi2(u64 val);
39
+int __weak __ctzdi2(u64 val)
4440 {
45
- return __ffs((u32)val);
41
+ return __ffs64(val);
4642 }
4743 EXPORT_SYMBOL(__ctzdi2);
48
-
49
-#elif BITS_PER_LONG == 64
50
-
51
-int __weak __clzdi2(long val)
52
-{
53
- return 64 - fls64((u64)val);
54
-}
55
-EXPORT_SYMBOL(__clzdi2);
56
-
57
-int __weak __ctzdi2(long val)
58
-{
59
- return __ffs64((u64)val);
60
-}
61
-EXPORT_SYMBOL(__ctzdi2);
62
-
63
-#else
64
-#error BITS_PER_LONG not 32 or 64
65
-#endif