Add LP64 limits.

This commit is contained in:
thorpej 2002-11-03 20:02:39 +00:00
parent 6348674004
commit 15d3b348c9
1 changed files with 26 additions and 1 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: limits.h,v 1.15 2001/05/04 15:12:32 simonb Exp $ */
/* $NetBSD: limits.h,v 1.16 2002/11/03 20:02:39 thorpej Exp $ */
/*
* Copyright (c) 1988, 1993
@ -66,12 +66,22 @@
#define INT_MAX 0x7fffffff /* max value for an int */
#define INT_MIN (-0x7fffffff-1) /* min value for an int */
#ifdef _LP64
#define ULONG_MAX 0xffffffffffffffffUL /* max for an unsigned long */
#define LONG_MAX 0x7fffffffffffffffL /* max for a long */
#define LONG_MIN (-0x7fffffffffffffffL-1) /* min for a long */
#else
#define ULONG_MAX 0xffffffffUL /* max value for an unsigned long */
#define LONG_MAX 0x7fffffffL /* max value for a long */
#define LONG_MIN (-0x7fffffff-1) /* min value for a long */
#endif
#if !defined(_ANSI_SOURCE)
#ifdef _LP64
#define SSIZE_MAX LONG_MAX /* max value for a ssize_t */
#else
#define SSIZE_MAX INT_MAX /* max value for a ssize_t */
#endif
#if !defined(_POSIX_C_SOURCE) && !defined(_XOPEN_SOURCE) || \
defined(_ISOC99_SOURCE) || (__STDC_VERSION__ - 0) >= 199901L
@ -81,20 +91,35 @@
#endif
#if !defined(_POSIX_C_SOURCE) && !defined(_XOPEN_SOURCE)
#ifdef _LP64
#define SIZE_T_MAX ULONG_MAX /* max value for a size_t */
#else
#define SIZE_T_MAX UINT_MAX /* max value for a size_t */
#endif
#ifdef _LP64
/* Quads and longs are the same on LP64. */
#define UQUAD_MAX (ULONG_MAX)
#define QUAD_MAX (LONG_MAX)
#define QUAD_MIN (LONG_MIN)
#else
/* GCC requires that quad constants be written as expressions. */
#define UQUAD_MAX ((u_quad_t)0-1) /* max value for a uquad_t */
/* max value for a quad_t */
#define QUAD_MAX ((quad_t)(UQUAD_MAX >> 1))
#define QUAD_MIN (-QUAD_MAX-1) /* min value for a quad_t */
#endif
#endif /* !_POSIX_C_SOURCE && !_XOPEN_SOURCE */
#endif /* !_ANSI_SOURCE */
#if !defined(_ANSI_SOURCE) && !defined(_POSIX_C_SOURCE) || \
defined(_XOPEN_SOURCE)
#ifdef _LP64
#define LONG_BIT 64
#else
#define LONG_BIT 32
#endif
#define WORD_BIT 32
#define DBL_DIG 15