Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 19 Nov 2009 18:56:07 +0000 (UTC)
From:      Nathan Whitehorn <nwhitehorn@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-projects@freebsd.org
Subject:   svn commit: r199541 - projects/ppc64/sys/powerpc/include
Message-ID:  <200911191856.nAJIu7Pt015662@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: nwhitehorn
Date: Thu Nov 19 18:56:06 2009
New Revision: 199541
URL: http://svn.freebsd.org/changeset/base/199541

Log:
  Fix some data type issues.

Modified:
  projects/ppc64/sys/powerpc/include/_align.h
  projects/ppc64/sys/powerpc/include/_limits.h

Modified: projects/ppc64/sys/powerpc/include/_align.h
==============================================================================
--- projects/ppc64/sys/powerpc/include/_align.h	Thu Nov 19 18:43:43 2009	(r199540)
+++ projects/ppc64/sys/powerpc/include/_align.h	Thu Nov 19 18:56:06 2009	(r199541)
@@ -41,12 +41,14 @@
 #ifndef _POWERPC_INCLUDE__ALIGN_H_
 #define	_POWERPC_INCLUDE__ALIGN_H_
 
+#include <sys/_types.h>
+
 /*
  * Round p (pointer or byte index) up to a correctly-aligned value
  * for all data types (int, long, ...).   The result is unsigned int
  * and must be cast to any desired pointer type.
  */
-#define	_ALIGNBYTES	(sizeof(int) - 1)
-#define	_ALIGN(p)	(((unsigned)(p) + _ALIGNBYTES) & ~_ALIGNBYTES)
+#define	_ALIGNBYTES	(sizeof(register_t) - 1)
+#define	_ALIGN(p)	(((uintptr_t)(p) + _ALIGNBYTES) & ~_ALIGNBYTES)
 
 #endif /* !_POWERPC_INCLUDE__ALIGN_H_ */

Modified: projects/ppc64/sys/powerpc/include/_limits.h
==============================================================================
--- projects/ppc64/sys/powerpc/include/_limits.h	Thu Nov 19 18:43:43 2009	(r199540)
+++ projects/ppc64/sys/powerpc/include/_limits.h	Thu Nov 19 18:56:06 2009	(r199541)
@@ -59,8 +59,7 @@
 #define	__INT_MAX	0x7fffffff	/* max value for an int */
 #define	__INT_MIN	(-0x7fffffff - 1)	/* min value for an int */
 
-/* Bad hack for gcc configured to give 64-bit longs. */
-#ifdef _LARGE_LONG
+#if defined(_LARGE_LONG) || defined(__LP64__)
 #define	__ULONG_MAX	0xffffffffffffffffUL
 #define	__LONG_MAX	0x7fffffffffffffffL
 #define	__LONG_MIN	(-0x7fffffffffffffffL - 1)
@@ -74,9 +73,13 @@
 #define	__LLONG_MAX	0x7fffffffffffffffLL	/* max value for a long long */
 #define	__LLONG_MIN	(-0x7fffffffffffffffLL - 1)  /* min for a long long */
 
+#ifdef __powerpc64__
+#define	__SSIZE_MAX	__LONG_MAX	/* max value for a ssize_t */
+#define	__SIZE_T_MAX	__ULONG_MAX	/* max value for a size_t */
+#else
 #define	__SSIZE_MAX	__INT_MAX	/* max value for a ssize_t */
-
 #define	__SIZE_T_MAX	__UINT_MAX	/* max value for a size_t */
+#endif
 
 #define	__OFF_MAX	__LLONG_MAX	/* max value for an off_t */
 #define	__OFF_MIN	__LLONG_MIN	/* min value for an off_t */
@@ -86,7 +89,7 @@
 #define	__QUAD_MAX	__LLONG_MAX	/* max value for a quad_t */
 #define	__QUAD_MIN	__LLONG_MIN	/* min value for a quad_t */
 
-#ifdef _LARGE_LONG
+#if defined(_LARGE_LONG) || defined(__LP64__)
 #define	__LONG_BIT	64
 #else
 #define	__LONG_BIT	32



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200911191856.nAJIu7Pt015662>