public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* PATCH: stdint constants
@ 2004-11-03 13:30 roman.fietze
  2004-11-04 17:45 ` H. Peter Anvin
  0 siblings, 1 reply; 2+ messages in thread
From: roman.fietze @ 2004-11-03 13:30 UTC (permalink / raw)
  To: linux-kernel

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2004-11-04 17:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-11-03 13:30 PATCH: stdint constants roman.fietze
2004-11-04 17:45 ` H. Peter Anvin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox