summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Elder <alex.elder@linaro.org>2014-01-23 23:54:00 (GMT)
committerMaciej Wereski <m.wereski@partner.samsung.com>2015-04-03 08:46:53 (GMT)
commit9be5b5c35323ffcb22871e19181a5126b3af65c1 (patch)
tree86dbd56332e2f59a2b5ef0401993a70e560d07d4
parent420070d4a70e6a671bdc3bd261c09cb251d67079 (diff)
downloadlinux-3.10-9be5b5c35323ffcb22871e19181a5126b3af65c1.zip
linux-3.10-9be5b5c35323ffcb22871e19181a5126b3af65c1.tar.gz
linux-3.10-9be5b5c35323ffcb22871e19181a5126b3af65c1.tar.bz2
kernel.h: define u8, s8, u32, etc. limits
Create constants that define the maximum and minimum values representable by the kernel types u8, s8, u16, s16, and so on. Signed-off-by: Alex Elder <elder@linaro.org> Cc: Sage Weil <sage@inktank.com> Cc: David Miller <davem@davemloft.net> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--include/linux/kernel.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index e9ef6d6..341551c 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -29,6 +29,19 @@
#define ULLONG_MAX (~0ULL)
#define SIZE_MAX (~(size_t)0)
+#define U8_MAX ((u8)~0U)
+#define S8_MAX ((s8)(U8_MAX>>1))
+#define S8_MIN ((s8)(-S8_MAX - 1))
+#define U16_MAX ((u16)~0U)
+#define S16_MAX ((s16)(U16_MAX>>1))
+#define S16_MIN ((s16)(-S16_MAX - 1))
+#define U32_MAX ((u32)~0U)
+#define S32_MAX ((s32)(U32_MAX>>1))
+#define S32_MIN ((s32)(-S32_MAX - 1))
+#define U64_MAX ((u64)~0ULL)
+#define S64_MAX ((s64)(U64_MAX>>1))
+#define S64_MIN ((s64)(-S64_MAX - 1))
+
#define STACK_MAGIC 0xdeadbeef
#define REPEAT_BYTE(x) ((~0ul / 0xff) * (x))