summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-03-22 15:58:27 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2012-03-22 15:58:27 -0700
commit989412bbd2835f1475d1528846693eddbac744c8 (patch)
tree192a4fdeeca43951cc69d30fad6b91c6196f9e8c
parent1f1e6e523e43e312c0e0d38c09828d53e9f709fc (diff)
downloadop-kernel-dev-989412bbd2835f1475d1528846693eddbac744c8.zip
op-kernel-dev-989412bbd2835f1475d1528846693eddbac744c8.tar.gz
vfs: tidy up fs/namei.c byte-repeat word constants
In commit commit 1de5b41cd3b2 ("fs/namei.c: fix warnings on 32-bit") Andrew said that there must be a tidier way of doing this. This is that tidier way. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--fs/namei.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/fs/namei.c b/fs/namei.c
index bd313d6..99a3471 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -1455,15 +1455,10 @@ done:
}
EXPORT_SYMBOL(full_name_hash);
-#ifdef CONFIG_64BIT
-#define ONEBYTES 0x0101010101010101ul
-#define SLASHBYTES 0x2f2f2f2f2f2f2f2ful
-#define HIGHBITS 0x8080808080808080ul
-#else
-#define ONEBYTES 0x01010101ul
-#define SLASHBYTES 0x2f2f2f2ful
-#define HIGHBITS 0x80808080ul
-#endif
+#define REPEAT_BYTE(x) ((~0ul / 0xff) * (x))
+#define ONEBYTES REPEAT_BYTE(0x01)
+#define SLASHBYTES REPEAT_BYTE('/')
+#define HIGHBITS REPEAT_BYTE(0x80)
/* Return the high bit set in the first byte that is a zero */
static inline unsigned long has_zero(unsigned long a)
OpenPOWER on IntegriCloud