drm/panthor: Don't add write fences to the shared BOs
[drm/drm-misc.git] / lib / clz_ctz.c
blobfb8c0c5c2bd277c2e14f8a45fbd4bf2efd744af3
1 // SPDX-License-Identifier: GPL-2.0-only
2 /*
3 * lib/clz_ctz.c
5 * Copyright (C) 2013 Chanho Min <chanho.min@lge.com>
7 * The functions in this file aren't called directly, but are required by
8 * GCC builtins such as __builtin_ctz, and therefore they can't be removed
9 * despite appearing unreferenced in kernel source.
11 * __c[lt]z[sd]i2 can be overridden by linking arch-specific versions.
14 #include <linux/export.h>
15 #include <linux/kernel.h>
17 int __weak __ctzsi2(int val);
18 int __weak __ctzsi2(int val)
20 return __ffs(val);
22 EXPORT_SYMBOL(__ctzsi2);
24 int __weak __clzsi2(int val);
25 int __weak __clzsi2(int val)
27 return 32 - fls(val);
29 EXPORT_SYMBOL(__clzsi2);
31 int __weak __clzdi2(u64 val);
32 int __weak __clzdi2(u64 val)
34 return 64 - fls64(val);
36 EXPORT_SYMBOL(__clzdi2);
38 int __weak __ctzdi2(u64 val);
39 int __weak __ctzdi2(u64 val)
41 return __ffs64(val);
43 EXPORT_SYMBOL(__ctzdi2);