aboutsummaryrefslogtreecommitdiff
path: root/nuttx/arch
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2012-12-07 16:00:56 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2012-12-07 16:00:56 +0000
commit756aa6b90920d0087ad708c3ad10e091be79e46e (patch)
treec29f3db20b8275cd22e7c4d36c3d722f2fdf6277 /nuttx/arch
parent4c98d2e73211a2bde3530c9f1f369efa0d0745e1 (diff)
downloadpx4-firmware-756aa6b90920d0087ad708c3ad10e091be79e46e.tar.gz
px4-firmware-756aa6b90920d0087ad708c3ad10e091be79e46e.tar.bz2
px4-firmware-756aa6b90920d0087ad708c3ad10e091be79e46e.zip
Patches from Petteri Aimonen + stdbool and rand() changes for Freddie Chopin
git-svn-id: http://svn.code.sf.net/p/nuttx/code/trunk@5415 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/arch')
-rw-r--r--nuttx/arch/8051/include/limits.h16
-rw-r--r--nuttx/arch/arm/include/limits.h18
-rw-r--r--nuttx/arch/avr/include/avr/limits.h18
-rw-r--r--nuttx/arch/avr/include/avr32/limits.h18
-rw-r--r--nuttx/arch/hc/include/hc12/limits.h19
-rw-r--r--nuttx/arch/hc/include/hcs12/limits.h19
-rw-r--r--nuttx/arch/mips/include/limits.h18
-rw-r--r--nuttx/arch/rgmp/include/limits.h18
-rw-r--r--nuttx/arch/sh/include/m16c/limits.h14
-rw-r--r--nuttx/arch/sh/include/sh1/limits.h18
-rw-r--r--nuttx/arch/sim/include/limits.h18
-rw-r--r--nuttx/arch/x86/include/i486/limits.h18
-rw-r--r--nuttx/arch/z16/include/limits.h22
-rw-r--r--nuttx/arch/z80/include/ez80/limits.h19
-rw-r--r--nuttx/arch/z80/include/z8/limits.h16
-rw-r--r--nuttx/arch/z80/include/z80/limits.h16
16 files changed, 141 insertions, 144 deletions
diff --git a/nuttx/arch/8051/include/limits.h b/nuttx/arch/8051/include/limits.h
index f3021f6cc..fd8c086aa 100644
--- a/nuttx/arch/8051/include/limits.h
+++ b/nuttx/arch/8051/include/limits.h
@@ -45,7 +45,7 @@
************************************************************/
#define CHAR_BIT 8
-#define SCHAR_MIN (-128)
+#define SCHAR_MIN (-SCHAR_MAX - 1)
#define SCHAR_MAX 127
#define UCHAR_MAX 255
@@ -59,17 +59,17 @@
#define CHAR_MAX SCHAR_MAX
#endif
-#define SHRT_MIN (-32768)
+#define SHRT_MIN (-SHRT_MAX - 1)
#define SHRT_MAX 32767
-#define USHRT_MAX 65535
+#define USHRT_MAX 65535U
-#define INT_MIN (-32768)
+#define INT_MIN (-INT_MAX - 1)
#define INT_MAX 32767
-#define UINT_MAX 65535
+#define UINT_MAX 65535U
/* These change on 32-bit and 64-bit platforms */
-#define LONG_MIN (-2147483648L)
+#define LONG_MIN (-LONG_MAX - 1)
#define LONG_MAX 2147483647L
#define ULONG_MAX 4294967295UL
@@ -77,8 +77,8 @@
* first byte holding data space information.
*/
-#define PTR_MIN (-8388608)
+#define PTR_MIN (-PTR_MAX - 1)
#define PTR_MAX 8388607
-#define UPTR_MAX 16777215
+#define UPTR_MAX 16777215U
#endif /* __ARCH_8051_INCLUDE_LIMITS_H */
diff --git a/nuttx/arch/arm/include/limits.h b/nuttx/arch/arm/include/limits.h
index 12c92f6cf..640db7e7b 100644
--- a/nuttx/arch/arm/include/limits.h
+++ b/nuttx/arch/arm/include/limits.h
@@ -45,7 +45,7 @@
****************************************************************************/
#define CHAR_BIT 8
-#define SCHAR_MIN (-128)
+#define SCHAR_MIN (-SCHAR_MAX - 1)
#define SCHAR_MAX 127
#define UCHAR_MAX 255
@@ -59,28 +59,28 @@
#define CHAR_MAX SCHAR_MAX
#endif
-#define SHRT_MIN (-32768)
+#define SHRT_MIN (-SHRT_MAX - 1)
#define SHRT_MAX 32767
-#define USHRT_MAX 65535
+#define USHRT_MAX 65535U
-#define INT_MIN (-2147483648)
+#define INT_MIN (-INT_MAX - 1)
#define INT_MAX 2147483647
-#define UINT_MAX 4294967295
+#define UINT_MAX 4294967295U
/* These change on 32-bit and 64-bit platforms */
-#define LONG_MIN (-2147483648L)
+#define LONG_MIN (-LONG_MAX - 1)
#define LONG_MAX 2147483647L
#define ULONG_MAX 4294967295UL
-#define LLONG_MIN (-9223372036854775808LL)
+#define LLONG_MIN (-LLONG_MAX - 1)
#define LLONG_MAX 9223372036854775807LL
#define ULLONG_MAX 18446744073709551615ULL
/* A pointer is 4 bytes */
-#define PTR_MIN (-2147483648)
+#define PTR_MIN (-PTR_MAX - 1)
#define PTR_MAX 2147483647
-#define UPTR_MAX 4294967295
+#define UPTR_MAX 4294967295U
#endif /* __ARCH_ARM_INCLUDE_LIMITS_H */
diff --git a/nuttx/arch/avr/include/avr/limits.h b/nuttx/arch/avr/include/avr/limits.h
index 67d66ce7a..db97a9a4a 100644
--- a/nuttx/arch/avr/include/avr/limits.h
+++ b/nuttx/arch/avr/include/avr/limits.h
@@ -45,7 +45,7 @@
****************************************************************************/
#define CHAR_BIT 8
-#define SCHAR_MIN (-128)
+#define SCHAR_MIN (-SCHAR_MAX - 1)
#define SCHAR_MAX 127
#define UCHAR_MAX 255
@@ -59,31 +59,31 @@
#define CHAR_MAX SCHAR_MAX
#endif
-#define SHRT_MIN (-32768)
+#define SHRT_MIN (-SHRT_MAX - 1)
#define SHRT_MAX 32767
-#define USHRT_MAX 65535
+#define USHRT_MAX 65535U
/* Integer is two bytes */
-#define INT_MIN (-32768)
+#define INT_MIN (-INT_MAX - 1)
#define INT_MAX 32767
-#define UINT_MAX 65535
+#define UINT_MAX 65535U
/* These change on 32-bit and 64-bit platforms */
-#define LONG_MIN (-2147483648L)
+#define LONG_MIN (-LONG_MAX - 1)
#define LONG_MAX 2147483647L
#define ULONG_MAX 4294967295UL
-#define LLONG_MIN (-9223372036854775808LL)
+#define LLONG_MIN (-LLONG_MAX - 1)
#define LLONG_MAX 9223372036854775807LL
#define ULLONG_MAX 18446744073709551615ULL
/* A pointer is two bytes */
-#define PTR_MIN (-32768)
+#define PTR_MIN (-PTR_MAX - 1)
#define PTR_MAX 32767
-#define UPTR_MAX 65535
+#define UPTR_MAX 65535U
#endif /* __ARCH_AVR_INCLUDE_AVR_LIMITS_H */
diff --git a/nuttx/arch/avr/include/avr32/limits.h b/nuttx/arch/avr/include/avr32/limits.h
index f4fad08ff..ce3dd783d 100644
--- a/nuttx/arch/avr/include/avr32/limits.h
+++ b/nuttx/arch/avr/include/avr32/limits.h
@@ -45,7 +45,7 @@
****************************************************************************/
#define CHAR_BIT 8
-#define SCHAR_MIN (-128)
+#define SCHAR_MIN (-SCHAR_MAX - 1)
#define SCHAR_MAX 127
#define UCHAR_MAX 255
@@ -59,31 +59,31 @@
#define CHAR_MAX SCHAR_MAX
#endif
-#define SHRT_MIN (-32768)
+#define SHRT_MIN (-SHRT_MAX - 1)
#define SHRT_MAX 32767
-#define USHRT_MAX 65535
+#define USHRT_MAX 65535U
/* Integer is four bytes */
-#define INT_MIN (-2147483648)
+#define INT_MIN (-INT_MAX - 1)
#define INT_MAX 2147483647
-#define UINT_MAX 4294967295
+#define UINT_MAX 4294967295U
/* These change on 32-bit and 64-bit platforms */
-#define LONG_MIN (-2147483648L)
+#define LONG_MIN (-LONG_MAX - 1)
#define LONG_MAX 2147483647L
#define ULONG_MAX 4294967295UL
-#define LLONG_MIN (-9223372036854775808LL)
+#define LLONG_MIN (-LLONG_MAX - 1)
#define LLONG_MAX 9223372036854775807LL
#define ULLONG_MAX 18446744073709551615ULL
/* A pointer is four bytes */
-#define PTR_MIN (-2147483648)
+#define PTR_MIN (-PTR_MAX - 1)
#define PTR_MAX 2147483647
-#define UPTR_MAX 4294967295
+#define UPTR_MAX 4294967295U
#endif /* __ARCH_AVR_INCLUDE_AVR32_LIMITS_H */
diff --git a/nuttx/arch/hc/include/hc12/limits.h b/nuttx/arch/hc/include/hc12/limits.h
index edb92c7e6..c35148a56 100644
--- a/nuttx/arch/hc/include/hc12/limits.h
+++ b/nuttx/arch/hc/include/hc12/limits.h
@@ -45,7 +45,7 @@
****************************************************************************/
#define CHAR_BIT 8
-#define SCHAR_MIN (-128)
+#define SCHAR_MIN (-SCHAR_MAX - 1)
#define SCHAR_MAX 127
#define UCHAR_MAX 255
@@ -59,39 +59,38 @@
#define CHAR_MAX SCHAR_MAX
#endif
-#define SHRT_MIN (-32768)
+#define SHRT_MIN (-SHRT_MAX - 1)
#define SHRT_MAX 32767
-#define USHRT_MAX 65535
+#define USHRT_MAX 65535U
/* The size of an integer is controlled with the -mshort or -mnoshort GCC
* options. GCC will set the pre-defined symbol __INT__ to indicate the size
* of an integer
*/
+#define INT_MIN (-INT_MAX - 1)
#if __INT__ == 32
-# define INT_MIN (-2147483648)
# define INT_MAX 2147483647
# define UINT_MAX 4294967295
#else
-# define INT_MIN (-32768)
# define INT_MAX 32767
-# define UINT_MAX 65535
+# define UINT_MAX 65535U
#endif
/* Long is 4-bytes and long long is 8 bytes in any case */
-#define LONG_MIN (-2147483648L)
+#define LONG_MIN (-LONG_MAX - 1)
#define LONG_MAX 2147483647L
#define ULONG_MAX 4294967295UL
-#define LLONG_MIN (-9223372036854775808LL)
+#define LLONG_MIN (-LLONG_MAX - 1)
#define LLONG_MAX 9223372036854775807LL
#define ULLONG_MAX 18446744073709551615ULL
/* A pointer is 2 bytes */
-#define PTR_MIN (-32768)
+#define PTR_MIN (-PTR_MAX - 1)
#define PTR_MAX 32767
-#define UPTR_MAX 65535
+#define UPTR_MAX 65535U
#endif /* __ARCH_HC_INCLUDE_HC12_LIMITS_H */
diff --git a/nuttx/arch/hc/include/hcs12/limits.h b/nuttx/arch/hc/include/hcs12/limits.h
index 597626484..5b10d910f 100644
--- a/nuttx/arch/hc/include/hcs12/limits.h
+++ b/nuttx/arch/hc/include/hcs12/limits.h
@@ -45,7 +45,7 @@
****************************************************************************/
#define CHAR_BIT 8
-#define SCHAR_MIN (-128)
+#define SCHAR_MIN (-SCHAR_MAX - 1)
#define SCHAR_MAX 127
#define UCHAR_MAX 255
@@ -59,39 +59,38 @@
#define CHAR_MAX SCHAR_MAX
#endif
-#define SHRT_MIN (-32768)
+#define SHRT_MIN (-SHRT_MAX - 1)
#define SHRT_MAX 32767
-#define USHRT_MAX 65535
+#define USHRT_MAX 65535U
/* The size of an integer is controlled with the -mshort or -mnoshort GCC
* options. GCC will set the pre-defined symbol __INT__ to indicate the size
* of an integer
*/
+#define INT_MIN (-INT_MAX - 1)
#if __INT__ == 32
-# define INT_MIN (-2147483648)
# define INT_MAX 2147483647
# define UINT_MAX 4294967295
#else
-# define INT_MIN (-32768)
# define INT_MAX 32767
-# define UINT_MAX 65535
+# define UINT_MAX 65535U
#endif
/* Long is 4-bytes and long long is 8 bytes in any case */
-#define LONG_MIN (-2147483648L)
+#define LONG_MIN (-LONG_MAX - 1)
#define LONG_MAX 2147483647L
#define ULONG_MAX 4294967295UL
-#define LLONG_MIN (-9223372036854775808LL)
+#define LLONG_MIN (-LLONG_MAX - 1)
#define LLONG_MAX 9223372036854775807LL
#define ULLONG_MAX 18446744073709551615ULL
/* A pointer is 2 bytes */
-#define PTR_MIN (-32768)
+#define PTR_MIN (-PTR_MAX - 1)
#define PTR_MAX 32767
-#define UPTR_MAX 65535
+#define UPTR_MAX 65535U
#endif /* __ARCH_HC_INCLUDE_HCS12_LIMITS_H */
diff --git a/nuttx/arch/mips/include/limits.h b/nuttx/arch/mips/include/limits.h
index 4feff7fe1..04001e55c 100644
--- a/nuttx/arch/mips/include/limits.h
+++ b/nuttx/arch/mips/include/limits.h
@@ -45,7 +45,7 @@
****************************************************************************/
#define CHAR_BIT 8
-#define SCHAR_MIN (-128)
+#define SCHAR_MIN (-SCHAR_MAX - 1)
#define SCHAR_MAX 127
#define UCHAR_MAX 255
@@ -59,29 +59,29 @@
#define CHAR_MAX SCHAR_MAX
#endif
-#define SHRT_MIN (-32768)
+#define SHRT_MIN (-SHRT_MAX - 1)
#define SHRT_MAX 32767
-#define USHRT_MAX 65535
+#define USHRT_MAX 65535U
-#define INT_MIN (-2147483648)
+#define INT_MIN (-INT_MAX - 1)
#define INT_MAX 2147483647
-#define UINT_MAX 4294967295
+#define UINT_MAX 4294967295U
/* These change on 32-bit and 64-bit platforms */
-#define LONG_MIN (-2147483648L)
+#define LONG_MIN (-LONG_MAX - 1)
#define LONG_MAX 2147483647L
#define ULONG_MAX 4294967295UL
-#define LLONG_MIN (-9223372036854775808LL)
+#define LLONG_MIN (-LLONG_MAX - 1)
#define LLONG_MAX 9223372036854775807LL
#define ULLONG_MAX 18446744073709551615ULL
/* A pointer is 4 bytes */
-#define PTR_MIN (-2147483648)
+#define PTR_MIN (-PTR_MAX - 1)
#define PTR_MAX 2147483647
-#define UPTR_MAX 4294967295
+#define UPTR_MAX 4294967295U
#endif /* __ARCH_MIPS_INCLUDE_LIMITS_H */
diff --git a/nuttx/arch/rgmp/include/limits.h b/nuttx/arch/rgmp/include/limits.h
index fdd8bfd10..a4458e301 100644
--- a/nuttx/arch/rgmp/include/limits.h
+++ b/nuttx/arch/rgmp/include/limits.h
@@ -45,7 +45,7 @@
************************************************************/
#define CHAR_BIT 8
-#define SCHAR_MIN (-128)
+#define SCHAR_MIN (-SCHAR_MAX - 1)
#define SCHAR_MAX 127
#define UCHAR_MAX 255
@@ -59,28 +59,28 @@
#define CHAR_MAX SCHAR_MAX
#endif
-#define SHRT_MIN (-32768)
+#define SHRT_MIN (-SHRT_MAX - 1)
#define SHRT_MAX 32767
-#define USHRT_MAX 65535
+#define USHRT_MAX 65535U
-#define INT_MIN (-2147483648)
+#define INT_MIN (-INT_MAX - 1)
#define INT_MAX 2147483647
-#define UINT_MAX 4294967295
+#define UINT_MAX 4294967295U
/* These change on 32-bit and 64-bit platforms */
-#define LONG_MIN (-2147483648L)
+#define LONG_MIN (-LONG_MAX - 1)
#define LONG_MAX 2147483647L
#define ULONG_MAX 4294967295UL
-#define LLONG_MIN (-9223372036854775808LL)
+#define LLONG_MIN (-LLONG_MAX - 1)
#define LLONG_MAX 9223372036854775807LL
#define ULLONG_MAX 18446744073709551615ULL
/* A pointer is 4 bytes */
-#define PTR_MIN (-2147483648)
+#define PTR_MIN (-PTR_MAX - 1)
#define PTR_MAX 2147483647
-#define UPTR_MAX 4294967295
+#define UPTR_MAX 4294967295U
#endif /* __ARCH_RGMP_INCLUDE_LIMITS_H */
diff --git a/nuttx/arch/sh/include/m16c/limits.h b/nuttx/arch/sh/include/m16c/limits.h
index d836522e7..dba3e4fdc 100644
--- a/nuttx/arch/sh/include/m16c/limits.h
+++ b/nuttx/arch/sh/include/m16c/limits.h
@@ -45,7 +45,7 @@
****************************************************************************/
#define CHAR_BIT 8
-#define SCHAR_MIN (-128)
+#define SCHAR_MIN (-SCHAR_MAX - 1)
#define SCHAR_MAX 127
#define UCHAR_MAX 255
@@ -59,9 +59,9 @@
#define CHAR_MAX SCHAR_MAX
#endif
-#define SHRT_MIN (-32768)
+#define SHRT_MIN (-SHRT_MAX - 1)
#define SHRT_MAX 32767
-#define USHRT_MAX 65535
+#define USHRT_MAX 65535U
/* For M16C, type int is 16-bits, the same size as type 'short int' */
@@ -71,18 +71,18 @@
/* For M16C, typle 'long int' is 32-bits */
-#define LONG_MIN (-2147483648L)
+#define LONG_MIN (-LONG_MAX - 1)
#define LONG_MAX 2147483647L
#define ULONG_MAX 4294967295UL
-#define LLONG_MIN (-9223372036854775808LL)
+#define LLONG_MIN (-LLONG_MAX - 1)
#define LLONG_MAX 9223372036854775807LL
#define ULLONG_MAX 18446744073709551615ULL
/* A pointer is 2 bytes */
-#define PTR_MIN (-32768)
+#define PTR_MIN (-PTR_MAX - 1)
#define PTR_MAX 32767
-#define UPTR_MAX 65535
+#define UPTR_MAX 65535U
#endif /* __ARCH_SH_INCLUDE_M16C_LIMITS_H */
diff --git a/nuttx/arch/sh/include/sh1/limits.h b/nuttx/arch/sh/include/sh1/limits.h
index ce9085bfb..33c8ebcd3 100644
--- a/nuttx/arch/sh/include/sh1/limits.h
+++ b/nuttx/arch/sh/include/sh1/limits.h
@@ -45,7 +45,7 @@
****************************************************************************/
#define CHAR_BIT 8
-#define SCHAR_MIN (-128)
+#define SCHAR_MIN (-SCHAR_MAX - 1)
#define SCHAR_MAX 127
#define UCHAR_MAX 255
@@ -59,30 +59,30 @@
#define CHAR_MAX SCHAR_MAX
#endif
-#define SHRT_MIN (-32768)
+#define SHRT_MIN (-SHRT_MAX - 1)
#define SHRT_MAX 32767
-#define USHRT_MAX 65535
+#define USHRT_MAX 65535U
/* On SH-1, type 'int' is 32-bits */
-#define INT_MIN (-2147483648)
+#define INT_MIN (-INT_MAX - 1)
#define INT_MAX 2147483647
-#define UINT_MAX 4294967295
+#define UINT_MAX 4294967295U
/* On SH-1, type 'long' is the same size as type 'int', 32-bits */
-#define LONG_MIN (-2147483648L)
+#define LONG_MIN (-LONG_MAX - 1)
#define LONG_MAX 2147483647L
#define ULONG_MAX 4294967295UL
-#define LLONG_MIN (-9223372036854775808LL)
+#define LLONG_MIN (-LLONG_MAX - 1)
#define LLONG_MAX 9223372036854775807LL
#define ULLONG_MAX 18446744073709551615ULL
/* A pointer is 4 bytes */
-#define PTR_MIN (-2147483648)
+#define PTR_MIN (-PTR_MAX - 1)
#define PTR_MAX 2147483647
-#define UPTR_MAX 4294967295
+#define UPTR_MAX 4294967295U
#endif /* __ARCH_SH_INCLUDE_SH1_LIMITS_H */
diff --git a/nuttx/arch/sim/include/limits.h b/nuttx/arch/sim/include/limits.h
index 9aa36b1d0..9288cb585 100644
--- a/nuttx/arch/sim/include/limits.h
+++ b/nuttx/arch/sim/include/limits.h
@@ -45,7 +45,7 @@
************************************************************/
#define CHAR_BIT 8
-#define SCHAR_MIN (-128)
+#define SCHAR_MIN (-SCHAR_MAX - 1)
#define SCHAR_MAX 127
#define UCHAR_MAX 255
@@ -59,28 +59,28 @@
#define CHAR_MAX SCHAR_MAX
#endif
-#define SHRT_MIN (-32768)
+#define SHRT_MIN (-SHRT_MAX - 1)
#define SHRT_MAX 32767
-#define USHRT_MAX 65535
+#define USHRT_MAX 65535U
-#define INT_MIN (-2147483648)
+#define INT_MIN (-INT_MAX - 1)
#define INT_MAX 2147483647
-#define UINT_MAX 4294967295
+#define UINT_MAX 4294967295U
/* These change on 32-bit and 64-bit platforms */
-#define LONG_MIN (-2147483648L)
+#define LONG_MIN (-LONG_MAX - 1)
#define LONG_MAX 2147483647L
#define ULONG_MAX 4294967295UL
-#define LLONG_MIN (-9223372036854775808LL)
+#define LLONG_MIN (-LLONG_MAX - 1)
#define LLONG_MAX 9223372036854775807LL
#define ULLONG_MAX 18446744073709551615ULL
/* A pointer is 4 bytes */
-#define PTR_MIN (-2147483648)
+#define PTR_MIN (-PTR_MAX - 1)
#define PTR_MAX 2147483647
-#define UPTR_MAX 4294967295
+#define UPTR_MAX 4294967295U
#endif /* __ARCH_SIM_INCLUDE_LIMITS_H */
diff --git a/nuttx/arch/x86/include/i486/limits.h b/nuttx/arch/x86/include/i486/limits.h
index c2a9a620f..aa167a0af 100644
--- a/nuttx/arch/x86/include/i486/limits.h
+++ b/nuttx/arch/x86/include/i486/limits.h
@@ -45,7 +45,7 @@
****************************************************************************/
#define CHAR_BIT 8
-#define SCHAR_MIN (-128)
+#define SCHAR_MIN (-SCHAR_MAX - 1)
#define SCHAR_MAX 127
#define UCHAR_MAX 255
@@ -59,28 +59,28 @@
#define CHAR_MAX SCHAR_MAX
#endif
-#define SHRT_MIN (-32768)
+#define SHRT_MIN (-SHRT_MAX - 1)
#define SHRT_MAX 32767
-#define USHRT_MAX 65535
+#define USHRT_MAX 65535U
-#define INT_MIN (-2147483648)
+#define INT_MIN (-INT_MAX - 1)
#define INT_MAX 2147483647
-#define UINT_MAX 4294967295
+#define UINT_MAX 4294967295U
/* These change on 32-bit and 64-bit platforms */
-#define LONG_MIN (-2147483648L)
+#define LONG_MIN (-LONG_MAX - 1)
#define LONG_MAX 2147483647L
#define ULONG_MAX 4294967295UL
-#define LLONG_MIN (-9223372036854775808LL)
+#define LLONG_MIN (-LLONG_MAX - 1)
#define LLONG_MAX 9223372036854775807LL
#define ULLONG_MAX 18446744073709551615ULL
/* A pointer is 4 bytes */
-#define PTR_MIN (-2147483648)
+#define PTR_MIN (-PTR_MAX - 1)
#define PTR_MAX 2147483647
-#define UPTR_MAX 4294967295
+#define UPTR_MAX 4294967295U
#endif /* __ARCH_X86_INCLUDE_I486_LIMITS_H */
diff --git a/nuttx/arch/z16/include/limits.h b/nuttx/arch/z16/include/limits.h
index 55ee7a2c5..6601c4737 100644
--- a/nuttx/arch/z16/include/limits.h
+++ b/nuttx/arch/z16/include/limits.h
@@ -45,7 +45,7 @@
****************************************************************************/
#define CHAR_BIT 8
-#define SCHAR_MIN (-128)
+#define SCHAR_MIN (-SCHAR_MAX - 1)
#define SCHAR_MAX 127
#define UCHAR_MAX 255
@@ -59,26 +59,26 @@
#define CHAR_MAX SCHAR_MAX
#endif
-#define SHRT_MIN (-32768)
+#define SHRT_MIN (-SHRT_MAX - 1)
#define SHRT_MAX 32767
-#define USHRT_MAX 65535
+#define USHRT_MAX 65535U
-#define INT_MIN (-2147483648)
+#define INT_MIN (-INT_MAX - 1)
#define INT_MAX 2147483647
-#define UINT_MAX 4294967295
+#define UINT_MAX 4294967295U
-#define LONG_MIN (-2147483648L)
+#define LONG_MIN (-LONG_MAX - 1)
#define LONG_MAX 2147483647L
#define ULONG_MAX 4294967295UL
-#define LLONG_MIN (-2147483648L)
-#define LLONG_MAX 2147483647L
-#define ULLONG_MAX 4294967295UL
+#define LLONG_MIN (-LLONG_MAX - 1)
+#define LLONG_MAX 2147483647LL
+#define ULLONG_MAX 4294967295ULL
/* A pointer is 4 bytes */
-#define PTR_MIN (-2147483648)
+#define PTR_MIN (-PTR_MAX - 1)
#define PTR_MAX 2147483647
-#define UPTR_MAX 4294967295
+#define UPTR_MAX 4294967295U
#endif /* __ARCH_Z16_INCLUDE_LIMITS_H */
diff --git a/nuttx/arch/z80/include/ez80/limits.h b/nuttx/arch/z80/include/ez80/limits.h
index 1dfa2afee..9e27b14e6 100644
--- a/nuttx/arch/z80/include/ez80/limits.h
+++ b/nuttx/arch/z80/include/ez80/limits.h
@@ -45,7 +45,7 @@
****************************************************************************/
#define CHAR_BIT 8
-#define SCHAR_MIN (-128)
+#define SCHAR_MIN (-SCHAR_MAX - 1)
#define SCHAR_MAX 127
#define UCHAR_MAX 255
@@ -59,17 +59,17 @@
#define CHAR_MAX SCHAR_MAX
#endif
-#define SHRT_MIN (-32768)
+#define SHRT_MIN (-SHRT_MAX - 1)
#define SHRT_MAX 32767
-#define USHRT_MAX 65535
+#define USHRT_MAX 65535U
-#define INT_MIN (-32768)
+#define INT_MIN (-INT_MAX - 1)
#define INT_MAX 32767
-#define UINT_MAX 65535
+#define UINT_MAX 65535U
/* These change on 32-bit and 64-bit platforms */
-#define LONG_MIN (-2147483648L)
+#define LONG_MIN (-LONG_MAX - 1)
#define LONG_MAX 2147483647L
#define ULONG_MAX 4294967295UL
@@ -80,14 +80,13 @@
* ADL mode - 24 bits
*/
+#define PTR_MIN (-PTR_MAX - 1)
#ifdef CONFIG_EZ80_Z80MODE
-#define PTR_MIN (-32768)
#define PTR_MAX 32767
-#define UPTR_MAX 65535
+#define UPTR_MAX 65535U
#else
-#define PTR_MIN (-8388608)
#define PTR_MAX 8388607
-#define UPTR_MAX 16777215
+#define UPTR_MAX 16777215U
#endif
#endif /* __ARCH_Z80_INCLUDE_EZ80_LIMITS_H */
diff --git a/nuttx/arch/z80/include/z8/limits.h b/nuttx/arch/z80/include/z8/limits.h
index 94614ee25..724d8c98d 100644
--- a/nuttx/arch/z80/include/z8/limits.h
+++ b/nuttx/arch/z80/include/z8/limits.h
@@ -45,7 +45,7 @@
****************************************************************************/
#define CHAR_BIT 8
-#define SCHAR_MIN (-128)
+#define SCHAR_MIN (-SCHAR_MAX - 1)
#define SCHAR_MAX 127
#define UCHAR_MAX 255
@@ -59,24 +59,24 @@
#define CHAR_MAX SCHAR_MAX
#endif
-#define SHRT_MIN (-32768)
+#define SHRT_MIN (-SHRT_MAX - 1)
#define SHRT_MAX 32767
-#define USHRT_MAX 65535
+#define USHRT_MAX 65535U
-#define INT_MIN (-32768)
+#define INT_MIN (-INT_MAX - 1)
#define INT_MAX 32767
-#define UINT_MAX 65535
+#define UINT_MAX 65535U
/* These change on 32-bit and 64-bit platforms */
-#define LONG_MIN (-2147483648L)
+#define LONG_MIN (-LONG_MAX - 1)
#define LONG_MAX 2147483647L
#define ULONG_MAX 4294967295UL
/* A pointer is 2 bytes */
-#define PTR_MIN (-32768)
+#define PTR_MIN (-PTR_MAX - 1)
#define PTR_MAX 32767
-#define UPTR_MAX 65535
+#define UPTR_MAX 65535U
#endif /* __ARCH_Z80_INCLUDE_Z8_LIMITS_H */
diff --git a/nuttx/arch/z80/include/z80/limits.h b/nuttx/arch/z80/include/z80/limits.h
index ff5770442..f1a1c1e17 100644
--- a/nuttx/arch/z80/include/z80/limits.h
+++ b/nuttx/arch/z80/include/z80/limits.h
@@ -45,7 +45,7 @@
****************************************************************************/
#define CHAR_BIT 8
-#define SCHAR_MIN (-128)
+#define SCHAR_MIN (-SCHAR_MAX - 1)
#define SCHAR_MAX 127
#define UCHAR_MAX 255
@@ -59,24 +59,24 @@
#define CHAR_MAX SCHAR_MAX
#endif
-#define SHRT_MIN (-32768)
+#define SHRT_MIN (-SHRT_MAX - 1)
#define SHRT_MAX 32767
-#define USHRT_MAX 65535
+#define USHRT_MAX 65535U
-#define INT_MIN (-32768)
+#define INT_MIN (-INT_MAX - 1)
#define INT_MAX 32767
-#define UINT_MAX 65535
+#define UINT_MAX 65535U
/* These change on 32-bit and 64-bit platforms */
-#define LONG_MIN (-2147483648L)
+#define LONG_MIN (-LONG_MAX - 1)
#define LONG_MAX 2147483647L
#define ULONG_MAX 4294967295UL
/* A pointer is 2 bytes */
-#define PTR_MIN (-32768)
+#define PTR_MIN (-PTR_MAX - 1)
#define PTR_MAX 32767
-#define UPTR_MAX 65535
+#define UPTR_MAX 65535U
#endif /* __ARCH_Z80_INCLUDE_Z80_LIMITS_H */