ref: 9a48df2e5794b0378f256b4721789bd9271f8a82
parent: 79764604b15e93be267a9e1dfda2d280bb366632
author: Steve Lhomme <robux4@ycbcr.xyz>
date: Fri Sep 28 05:41:56 EDT 2018
add helper functions for ctz/clz
--- 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__ */