Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/videolan/dav1d.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Lhomme <robux4@ycbcr.xyz>2018-09-28 10:41:56 +0300
committerSteve Lhomme <robux4@ycbcr.xyz>2018-09-28 13:09:41 +0300
commit9a48df2e5794b0378f256b4721789bd9271f8a82 (patch)
tree63d239f71ee54499261f0fbcf3976ca7dba5b8df /include
parent79764604b15e93be267a9e1dfda2d280bb366632 (diff)
add helper functions for ctz/clz
Diffstat (limited to 'include')
-rw-r--r--include/common/attributes.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/include/common/attributes.h b/include/common/attributes.h
index b2315bc..f3b0d47 100644
--- a/include/common/attributes.h
+++ b/include/common/attributes.h
@@ -51,4 +51,16 @@
#define ALIGN_STK_16(type, var, sz1d, sznd) \
ALIGN(type var[sz1d]sznd, 16)
+static inline int ctz(const unsigned int mask) {
+ return __builtin_ctz(mask);
+}
+
+static inline int clz(const unsigned int mask) {
+ return __builtin_clz(mask);
+}
+
+static inline int clzll(const unsigned long long mask) {
+ return __builtin_clzll(mask);
+}
+
#endif /* __DAV1D_COMMON_ATTRIBUTES_H__ */