Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/arm/include Take advantage of compiler predefines f...
details: https://anonhg.NetBSD.org/src/rev/8c2b0e3d5a6e
branches: trunk
changeset: 326431:8c2b0e3d5a6e
user: matt <matt%NetBSD.org@localhost>
date: Wed Jan 29 01:40:35 2014 +0000
description:
Take advantage of compiler predefines for types.
Add _LP64 support.
diffstat:
sys/arch/arm/include/int_fmtio.h | 68 +++++++++++++++++++-
sys/arch/arm/include/int_limits.h | 17 ++++-
sys/arch/arm/include/int_mwgwtypes.h | 119 +++++++++++++++++++++++-----------
sys/arch/arm/include/int_types.h | 78 ++++++++++++----------
sys/arch/arm/include/limits.h | 31 +++++++--
5 files changed, 231 insertions(+), 82 deletions(-)
diffs (truncated from 547 to 300 lines):
diff -r 329b4f90223e -r 8c2b0e3d5a6e sys/arch/arm/include/int_fmtio.h
--- a/sys/arch/arm/include/int_fmtio.h Wed Jan 29 01:36:43 2014 +0000
+++ b/sys/arch/arm/include/int_fmtio.h Wed Jan 29 01:40:35 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: int_fmtio.h,v 1.5 2008/08/29 19:08:29 matt Exp $ */
+/* $NetBSD: int_fmtio.h,v 1.6 2014/01/29 01:40:35 matt Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -46,9 +46,15 @@
#define PRIdLEAST16 "d" /* int_least16_t */
#define PRIdLEAST32 "d" /* int_least32_t */
#define PRIdLEAST64 "lld" /* int_least64_t */
+#ifdef _LP64
+#define PRIdFAST8 "ld" /* int_fast8_t */
+#define PRIdFAST16 "ld" /* int_fast16_t */
+#define PRIdFAST32 "ld" /* int_fast32_t */
+#else
#define PRIdFAST8 "d" /* int_fast8_t */
#define PRIdFAST16 "d" /* int_fast16_t */
#define PRIdFAST32 "d" /* int_fast32_t */
+#endif
#define PRIdFAST64 "lld" /* int_fast64_t */
#define PRIdMAX "lld" /* intmax_t */
#define PRIdPTR "ld" /* intptr_t */
@@ -61,9 +67,15 @@
#define PRIiLEAST16 "i" /* int_least16_t */
#define PRIiLEAST32 "i" /* int_least32_t */
#define PRIiLEAST64 "lli" /* int_least64_t */
+#ifdef _LP64
+#define PRIiFAST8 "li" /* int_fast8_t */
+#define PRIiFAST16 "li" /* int_fast16_t */
+#define PRIiFAST32 "li" /* int_fast32_t */
+#else
#define PRIiFAST8 "i" /* int_fast8_t */
#define PRIiFAST16 "i" /* int_fast16_t */
#define PRIiFAST32 "i" /* int_fast32_t */
+#endif
#define PRIiFAST64 "lli" /* int_fast64_t */
#define PRIiMAX "lli" /* intmax_t */
#define PRIiPTR "li" /* intptr_t */
@@ -78,9 +90,15 @@
#define PRIoLEAST16 "o" /* uint_least16_t */
#define PRIoLEAST32 "o" /* uint_least32_t */
#define PRIoLEAST64 "llo" /* uint_least64_t */
+#ifdef _LP64
+#define PRIoFAST8 "lo" /* uint_fast8_t */
+#define PRIoFAST16 "lo" /* uint_fast16_t */
+#define PRIoFAST32 "lo" /* uint_fast32_t */
+#else
#define PRIoFAST8 "o" /* uint_fast8_t */
#define PRIoFAST16 "o" /* uint_fast16_t */
#define PRIoFAST32 "o" /* uint_fast32_t */
+#endif
#define PRIoFAST64 "llo" /* uint_fast64_t */
#define PRIoMAX "llo" /* uintmax_t */
#define PRIoPTR "lo" /* uintptr_t */
@@ -93,9 +111,15 @@
#define PRIuLEAST16 "u" /* uint_least16_t */
#define PRIuLEAST32 "u" /* uint_least32_t */
#define PRIuLEAST64 "llu" /* uint_least64_t */
+#ifdef _LP64
+#define PRIuFAST8 "lu" /* uint_fast8_t */
+#define PRIuFAST16 "lu" /* uint_fast16_t */
+#define PRIuFAST32 "lu" /* uint_fast32_t */
+#else
#define PRIuFAST8 "u" /* uint_fast8_t */
#define PRIuFAST16 "u" /* uint_fast16_t */
#define PRIuFAST32 "u" /* uint_fast32_t */
+#endif
#define PRIuFAST64 "llu" /* uint_fast64_t */
#define PRIuMAX "llu" /* uintmax_t */
#define PRIuPTR "lu" /* uintptr_t */
@@ -108,9 +132,15 @@
#define PRIxLEAST16 "x" /* uint_least16_t */
#define PRIxLEAST32 "x" /* uint_least32_t */
#define PRIxLEAST64 "llx" /* uint_least64_t */
+#ifdef _LP64
+#define PRIxFAST8 "lx" /* uint_fast8_t */
+#define PRIxFAST16 "lx" /* uint_fast16_t */
+#define PRIxFAST32 "lx" /* uint_fast32_t */
+#else
#define PRIxFAST8 "x" /* uint_fast8_t */
#define PRIxFAST16 "x" /* uint_fast16_t */
#define PRIxFAST32 "x" /* uint_fast32_t */
+#endif
#define PRIxFAST64 "llx" /* uint_fast64_t */
#define PRIxMAX "llx" /* uintmax_t */
#define PRIxPTR "lx" /* uintptr_t */
@@ -123,9 +153,15 @@
#define PRIXLEAST16 "X" /* uint_least16_t */
#define PRIXLEAST32 "X" /* uint_least32_t */
#define PRIXLEAST64 "llX" /* uint_least64_t */
+#ifdef _LP64
+#define PRIXFAST8 "lX" /* uint_fast8_t */
+#define PRIXFAST16 "lX" /* uint_fast16_t */
+#define PRIXFAST32 "lX" /* uint_fast32_t */
+#else
#define PRIXFAST8 "X" /* uint_fast8_t */
#define PRIXFAST16 "X" /* uint_fast16_t */
#define PRIXFAST32 "X" /* uint_fast32_t */
+#endif
#define PRIXFAST64 "llX" /* uint_fast64_t */
#define PRIXMAX "llX" /* uintmax_t */
#define PRIXPTR "lX" /* uintptr_t */
@@ -140,9 +176,15 @@
#define SCNdLEAST16 "hd" /* int_least16_t */
#define SCNdLEAST32 "d" /* int_least32_t */
#define SCNdLEAST64 "lld" /* int_least64_t */
+#ifdef _LP64
+#define SCNdFAST8 "ld" /* int_fast8_t */
+#define SCNdFAST16 "ld" /* int_fast16_t */
+#define SCNdFAST32 "ld" /* int_fast32_t */
+#else
#define SCNdFAST8 "d" /* int_fast8_t */
#define SCNdFAST16 "d" /* int_fast16_t */
#define SCNdFAST32 "d" /* int_fast32_t */
+#endif
#define SCNdFAST64 "lld" /* int_fast64_t */
#define SCNdMAX "lld" /* intmax_t */
#define SCNdPTR "ld" /* intptr_t */
@@ -155,9 +197,15 @@
#define SCNiLEAST16 "hi" /* int_least16_t */
#define SCNiLEAST32 "i" /* int_least32_t */
#define SCNiLEAST64 "lli" /* int_least64_t */
+#ifdef _LP64
+#define SCNiFAST8 "li" /* int_fast8_t */
+#define SCNiFAST16 "li" /* int_fast16_t */
+#define SCNiFAST32 "li" /* int_fast32_t */
+#else
#define SCNiFAST8 "i" /* int_fast8_t */
#define SCNiFAST16 "i" /* int_fast16_t */
#define SCNiFAST32 "i" /* int_fast32_t */
+#endif
#define SCNiFAST64 "lli" /* int_fast64_t */
#define SCNiMAX "lli" /* intmax_t */
#define SCNiPTR "li" /* intptr_t */
@@ -172,9 +220,15 @@
#define SCNoLEAST16 "ho" /* uint_least16_t */
#define SCNoLEAST32 "o" /* uint_least32_t */
#define SCNoLEAST64 "llo" /* uint_least64_t */
+#ifdef _LP64
+#define SCNoFAST8 "lo" /* uint_fast8_t */
+#define SCNoFAST16 "lo" /* uint_fast16_t */
+#define SCNoFAST32 "lo" /* uint_fast32_t */
+#else
#define SCNoFAST8 "o" /* uint_fast8_t */
#define SCNoFAST16 "o" /* uint_fast16_t */
#define SCNoFAST32 "o" /* uint_fast32_t */
+#endif
#define SCNoFAST64 "llo" /* uint_fast64_t */
#define SCNoMAX "llo" /* uintmax_t */
#define SCNoPTR "lo" /* uintptr_t */
@@ -187,9 +241,15 @@
#define SCNuLEAST16 "hu" /* uint_least16_t */
#define SCNuLEAST32 "u" /* uint_least32_t */
#define SCNuLEAST64 "llu" /* uint_least64_t */
+#ifdef _LP64
+#define SCNuFAST8 "lu" /* uint_fast8_t */
+#define SCNuFAST16 "lu" /* uint_fast16_t */
+#define SCNuFAST32 "lu" /* uint_fast32_t */
+#else
#define SCNuFAST8 "u" /* uint_fast8_t */
#define SCNuFAST16 "u" /* uint_fast16_t */
#define SCNuFAST32 "u" /* uint_fast32_t */
+#endif
#define SCNuFAST64 "llu" /* uint_fast64_t */
#define SCNuMAX "llu" /* uintmax_t */
#define SCNuPTR "lu" /* uintptr_t */
@@ -202,9 +262,15 @@
#define SCNxLEAST16 "hx" /* uint_least16_t */
#define SCNxLEAST32 "x" /* uint_least32_t */
#define SCNxLEAST64 "llx" /* uint_least64_t */
+#ifdef _LP64
+#define SCNxFAST8 "lx" /* uint_fast8_t */
+#define SCNxFAST16 "lx" /* uint_fast16_t */
+#define SCNxFAST32 "lx" /* uint_fast32_t */
+#else
#define SCNxFAST8 "x" /* uint_fast8_t */
#define SCNxFAST16 "x" /* uint_fast16_t */
#define SCNxFAST32 "x" /* uint_fast32_t */
+#endif
#define SCNxFAST64 "llx" /* uint_fast64_t */
#define SCNxMAX "llx" /* uintmax_t */
#define SCNxPTR "lx" /* uintptr_t */
diff -r 329b4f90223e -r 8c2b0e3d5a6e sys/arch/arm/include/int_limits.h
--- a/sys/arch/arm/include/int_limits.h Wed Jan 29 01:36:43 2014 +0000
+++ b/sys/arch/arm/include/int_limits.h Wed Jan 29 01:40:35 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: int_limits.h,v 1.9 2008/08/29 19:08:29 matt Exp $ */
+/* $NetBSD: int_limits.h,v 1.10 2014/01/29 01:40:35 matt Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -98,9 +98,15 @@
/* 7.18.2.4 Limits of integer types capable of holding object pointers */
+#ifdef _LP64
+#define INTPTR_MIN (-0x7fffffffffffffffL-1) /* intptr_t */
+#define INTPTR_MAX 0x7fffffffffffffffL /* intptr_t */
+#define UINTPTR_MAX 0xffffffffffffffffUL /* uintptr_t */
+#else
#define INTPTR_MIN (-0x7fffffffL-1) /* intptr_t */
#define INTPTR_MAX 0x7fffffffL /* intptr_t */
#define UINTPTR_MAX 0xffffffffUL /* uintptr_t */
+#endif
/* 7.18.2.5 Limits of greatest-width integer types */
@@ -114,14 +120,23 @@
*/
/* limits of ptrdiff_t */
+#ifdef _LP64
+#define PTRDIFF_MIN (-0x7fffffffffffffffL-1) /* ptrdiff_t */
+#define PTRDIFF_MAX 0x7fffffffffffffffL /* ptrdiff_t */
+#else
#define PTRDIFF_MIN (-0x7fffffffL-1) /* ptrdiff_t */
#define PTRDIFF_MAX 0x7fffffffL /* ptrdiff_t */
+#endif
/* limits of sig_atomic_t */
#define SIG_ATOMIC_MIN (-0x7fffffff-1) /* sig_atomic_t */
#define SIG_ATOMIC_MAX 0x7fffffff /* sig_atomic_t */
/* limit of size_t */
+#ifdef _LP64
+#define SIZE_MAX 0xffffffffffffffffUL /* size_t */
+#else
#define SIZE_MAX 0xffffffffUL /* size_t */
+#endif
#endif /* !_ARM_INT_LIMITS_H_ */
diff -r 329b4f90223e -r 8c2b0e3d5a6e sys/arch/arm/include/int_mwgwtypes.h
--- a/sys/arch/arm/include/int_mwgwtypes.h Wed Jan 29 01:36:43 2014 +0000
+++ b/sys/arch/arm/include/int_mwgwtypes.h Wed Jan 29 01:40:35 2014 +0000
@@ -1,11 +1,11 @@
-/* $NetBSD: int_mwgwtypes.h,v 1.4 2008/04/28 20:23:14 martin Exp $ */
+/* $NetBSD: int_mwgwtypes.h,v 1.5 2014/01/29 01:40:35 matt Exp $ */
/*-
- * Copyright (c) 2001 The NetBSD Foundation, Inc.
+ * Copyright (c) 2014 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
- * by Klaus Klein.
+ * by Matt Thomas of 3am Software Foundry.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -38,49 +38,92 @@
/* 7.18.1.2 Minimum-width integer types */
-typedef signed char int_least8_t;
-typedef unsigned char uint_least8_t;
-typedef short int int_least16_t;
-typedef unsigned short int uint_least16_t;
-typedef int int_least32_t;
-typedef unsigned int uint_least32_t;
-#ifdef __COMPILER_INT64__
-typedef __COMPILER_INT64__ int_least64_t;
-typedef __COMPILER_UINT64__ uint_least64_t;
-#else
-/* LONGLONG */
-typedef long long int int_least64_t;
-/* LONGLONG */
-typedef unsigned long long int uint_least64_t;
+#ifndef __INT_LEAST8_TYPE__
+# define __INT_LEAST8_TYPE__ signed char
+#endif
+#ifndef __UINT_LEAST8_TYPE__
+# define __UINT_LEAST8_TYPE__ unsigned char
+#endif
+#ifndef __INT_LEAST16_TYPE__
+# define __INT_LEAST16_TYPE__ short int
+#endif
+#ifndef __UINT_LEAST16_TYPE__
+# define __UINT_LEAST16_TYPE__ short unsigned int
+#endif
+#ifndef __INT_LEAST32_TYPE__
+# define __INT_LEAST32_TYPE__ int
+#endif
+#ifndef __UINT_LEAST32_TYPE__
+# define __UINT_LEAST32_TYPE__ unsigned int
+#endif
+#ifndef __INT_LEAST64_TYPE__
+# define __INT_LEAST64_TYPE__ long long int
+#endif
+#ifndef __UINT_LEAST64_TYPE__
+# define __UINT_LEAST64_TYPE__ long long unsigned int
#endif
+typedef __INT_LEAST8_TYPE__ int_least8_t;
+typedef __UINT_LEAST8_TYPE__ uint_least8_t;
+typedef __INT_LEAST16_TYPE__ int_least16_t;
+typedef __UINT_LEAST16_TYPE__ uint_least16_t;
+typedef __INT_LEAST32_TYPE__ int_least32_t;
Home |
Main Index |
Thread Index |
Old Index