PATCH: stdint constants

From: roman . fietze
Date: Wed Nov 03 2004 - 08:32:54 EST


Hello,

First of all: sorry for using Notes MUA, but cannot route to kernel.org
due to NJABL.

Allthough many books recommend using the types uint8_t to uint64_t as
well as their signed counterparts, I could not find the MIX/MAX values
for those types in any kernel include file.

Tested on a 2.4 ARM/PPC/I386 kernel with gcc 3.0.4/3.2.2/3.3.2. Not
tested on any 64 bit architecture.

Any comments to this patch?


diff -uprN linux-2.6.9/include/linux/kernel.h
linux-2.6.9-stdint/include/linux/kernel.h
--- linux-2.6.9/include/linux/kernel.h 2004-10-18 23:53:05.000000000
+0200
+++ linux-2.6.9-stdint/include/linux/kernel.h 2004-11-03
14:15:24.000000000 +0100
@@ -23,6 +23,30 @@
#define LONG_MIN (-LONG_MAX - 1)
#define ULONG_MAX (~0UL)

+#define INT8_MIN (-128)
+#define INT16_MIN (-32767-1)
+#define INT32_MIN (-2147483647-1)
+
+#define INT8_MAX (127)
+#define INT16_MAX (32767)
+#define INT32_MAX (2147483647)
+
+#define UINT8_MAX (255)
+#define UINT16_MAX (65535)
+#define UINT32_MAX (4294967295U)
+
+#if defined(__GNUC__) && !defined(__STRICT_ANSI__)
+# if BITS_PER_LONG == 32
+# define INT64_MIN (-9223372036854775807LL - 1LL)
+# define INT64_MAX (9223372036854775807LL)
+# define UINT64_MAX (18446744073709551615ULL)
+# else
+# define INT64_MIN (-9223372036854775807L - 1L)
+# define INT64_MAX (9223372036854775807L)
+# define UINT64_MAX (18446744073709551615UL)
+# endif
+#endif
+
#define STACK_MAGIC 0xdeadbeef

#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))



Roman

--
Roman Fietze Telemotive AG Büro Mühlhausen
Breitwiesen 73347 Mühlhausen
Tel.: +49(0)7335 18493-45 http://www.telemotive.de

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/