b/include/asm-generic/word-at-a-time.h
@@ -50,10 +50,20 @@ static inline bool has_zero(unsigned long val,
unsigned long *data, const struct
}
#ifndef zero_bytemask
+static inline unsigned long __zero_bytemask(unsigned long shift)
+{
+ unsigned long ret;
+ if (shift != BITS_PER_LONG)
+ ret = (~0ul << shift);
+ else
+ ret = 0;
+ return ret;
+}
+
#ifdef CONFIG_64BIT
-#define zero_bytemask(mask) (~0ul << fls64(mask))
+#define zero_bytemask(mask) (__zero_bytemask(fls64(mask)))
#else
-#define zero_bytemask(mask) (~0ul << fls(mask))
+#define zero_bytemask(mask) (__zero_bytemask(fls(mask)))
#endif /* CONFIG_64BIT */
#endif /* zero_bytemask */