2011-04-27 23:42:16 +02:00
|
|
|
/** @file
|
|
|
|
The header <limits.h> defines several macros that expand to various limits and
|
|
|
|
parameters of the standard integer types.
|
|
|
|
|
2011-08-06 01:02:43 +02:00
|
|
|
The values given below are constant expressions suitable for
|
|
|
|
use in #if preprocessing directives. Except for CHAR_BIT and
|
|
|
|
MB_LEN_MAX, they have the same
|
2011-04-27 23:42:16 +02:00
|
|
|
type as would an expression that is an object of the corresponding type
|
2011-08-06 01:02:43 +02:00
|
|
|
converted according to the integer promotions.
|
|
|
|
|
2012-06-15 21:58:39 +02:00
|
|
|
Copyright (c) 2010 - 2012, Intel Corporation. All rights reserved.<BR>
|
2011-04-27 23:42:16 +02:00
|
|
|
This program and the accompanying materials are licensed and made available under
|
|
|
|
the terms and conditions of the BSD License that accompanies this distribution.
|
|
|
|
The full text of the license may be found at
|
2011-08-06 01:02:43 +02:00
|
|
|
http://opensource.org/licenses/bsd-license.
|
2011-04-27 23:42:16 +02:00
|
|
|
|
|
|
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
|
|
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|
|
|
**/
|
|
|
|
#ifndef _LIMITS_H
|
|
|
|
#define _LIMITS_H
|
|
|
|
#include <sys/EfiCdefs.h>
|
|
|
|
#include <Library/PcdLib.h>
|
|
|
|
|
|
|
|
/* Get the architecturally defined limits for this compilation unit. */
|
|
|
|
#include <machine/limits.h>
|
|
|
|
|
2011-08-06 01:02:43 +02:00
|
|
|
/* Define the values required by the ISO/IEC 9899 Specification. */
|
2011-04-27 23:42:16 +02:00
|
|
|
|
2011-08-06 01:02:43 +02:00
|
|
|
/** Maximum number of bytes in a multibyte character, for any supported locale. **/
|
2012-06-15 21:58:39 +02:00
|
|
|
#define MB_LEN_MAX 4 /* UTF-8 can require up to 4 bytes */
|
2011-04-27 23:42:16 +02:00
|
|
|
|
2011-08-06 01:02:43 +02:00
|
|
|
/** Number of bits comprising the smallest object that is not a bit-field (byte). **/
|
2011-04-27 23:42:16 +02:00
|
|
|
#define CHAR_BIT __CHAR_BIT
|
|
|
|
|
2011-08-06 01:02:43 +02:00
|
|
|
/** Minimum value for an object of type signed char. **/
|
2011-04-27 23:42:16 +02:00
|
|
|
#define SCHAR_MIN __SCHAR_MIN
|
|
|
|
|
2011-08-06 01:02:43 +02:00
|
|
|
/** Maximum value for an object of type signed char. **/
|
2011-04-27 23:42:16 +02:00
|
|
|
#define SCHAR_MAX __SCHAR_MAX
|
|
|
|
|
2011-08-06 01:02:43 +02:00
|
|
|
/** Maximum value for an object of type unsigned char. **/
|
2011-04-27 23:42:16 +02:00
|
|
|
#define UCHAR_MAX __UCHAR_MAX
|
|
|
|
|
|
|
|
#ifdef __CHAR_UNSIGNED__
|
2011-08-06 01:02:43 +02:00
|
|
|
/** Maximum value for an object of type char. **/
|
2011-04-27 23:42:16 +02:00
|
|
|
#define CHAR_MAX UCHAR_MAX
|
2011-08-06 01:02:43 +02:00
|
|
|
/** Minimum value for an object of type char. **/
|
2011-04-27 23:42:16 +02:00
|
|
|
#define CHAR_MIN 0
|
|
|
|
#else
|
2011-08-06 01:02:43 +02:00
|
|
|
/** Maximum value for an object of type char. **/
|
2011-04-27 23:42:16 +02:00
|
|
|
#define CHAR_MAX SCHAR_MAX
|
2011-08-06 01:02:43 +02:00
|
|
|
/** Minimum value for an object of type char. **/
|
2011-04-27 23:42:16 +02:00
|
|
|
#define CHAR_MIN SCHAR_MIN
|
|
|
|
#endif
|
|
|
|
|
2011-08-06 01:02:43 +02:00
|
|
|
/** Minimum value for an object of type short int. **/
|
2011-04-27 23:42:16 +02:00
|
|
|
#define SHRT_MIN __SHRT_MIN
|
|
|
|
|
2011-08-06 01:02:43 +02:00
|
|
|
/** Maximum value for an object of type short int. **/
|
2011-04-27 23:42:16 +02:00
|
|
|
#define SHRT_MAX __SHRT_MAX
|
|
|
|
|
2011-08-06 01:02:43 +02:00
|
|
|
/** Maximum value for an object of type unsigned short int. **/
|
2011-04-27 23:42:16 +02:00
|
|
|
#define USHRT_MAX __USHRT_MAX
|
|
|
|
|
2011-08-06 01:02:43 +02:00
|
|
|
/** Minimum value for an object of type int. **/
|
2011-04-27 23:42:16 +02:00
|
|
|
#define INT_MIN __INT_MIN
|
|
|
|
|
2011-08-06 01:02:43 +02:00
|
|
|
/** Maximum value for an object of type int. **/
|
2011-04-27 23:42:16 +02:00
|
|
|
#define INT_MAX __INT_MAX
|
|
|
|
|
2011-08-06 01:02:43 +02:00
|
|
|
/** Maximum value for an object of type unsigned int. **/
|
2011-04-27 23:42:16 +02:00
|
|
|
#define UINT_MAX __UINT_MAX
|
|
|
|
|
2011-08-06 01:02:43 +02:00
|
|
|
/** Minimum value for an object of type long int. **/
|
2011-04-27 23:42:16 +02:00
|
|
|
#define LONG_MIN __LONG_MIN
|
|
|
|
|
2011-08-06 01:02:43 +02:00
|
|
|
/** Maximum value for an object of type long int. **/
|
2011-04-27 23:42:16 +02:00
|
|
|
#define LONG_MAX __LONG_MAX
|
|
|
|
|
2011-08-06 01:02:43 +02:00
|
|
|
/** Maximum value for an object of type unsigned long int. **/
|
2011-04-27 23:42:16 +02:00
|
|
|
#define ULONG_MAX __ULONG_MAX
|
|
|
|
|
2011-08-06 01:02:43 +02:00
|
|
|
/** Minimum value for an object of type long long int. **/
|
2011-04-27 23:42:16 +02:00
|
|
|
#define LLONG_MIN __LLONG_MIN
|
|
|
|
|
2011-08-06 01:02:43 +02:00
|
|
|
/** Maximum value for an object of type long long int. **/
|
2011-04-27 23:42:16 +02:00
|
|
|
#define LLONG_MAX __LLONG_MAX
|
|
|
|
|
2011-08-06 01:02:43 +02:00
|
|
|
/** Maximum value for an object of type unsigned long long int. **/
|
2011-04-27 23:42:16 +02:00
|
|
|
#define ULLONG_MAX __ULLONG_MAX
|
|
|
|
|
|
|
|
/* Object limits used in the Standard Libraries */
|
|
|
|
#if (PcdGet32(PcdMaximumAsciiStringLength) > 0)
|
2011-08-06 01:02:43 +02:00
|
|
|
/** Maximum length of an arbitrary "narrow-character" string. **/
|
2011-04-27 23:42:16 +02:00
|
|
|
#define ASCII_STRING_MAX PcdGet32(PcdMaximumAsciiStringLength)
|
|
|
|
#else
|
2011-08-06 01:02:43 +02:00
|
|
|
/** Maximum length of an arbitrary "narrow-character" string. **/
|
2011-04-27 23:42:16 +02:00
|
|
|
#define ASCII_STRING_MAX 256
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if (PcdGet32(PcdMaximumUnicodeStringLength) > 0)
|
2011-08-06 01:02:43 +02:00
|
|
|
/** Maximum length of an arbitrary "wide-character" string. **/
|
2011-04-27 23:42:16 +02:00
|
|
|
#define UNICODE_STRING_MAX PcdGet32(PcdMaximumUnicodeStringLength)
|
|
|
|
#else
|
2011-08-06 01:02:43 +02:00
|
|
|
/** Maximum length of an arbitrary "wide-character" string. **/
|
2011-04-27 23:42:16 +02:00
|
|
|
#define UNICODE_STRING_MAX 512
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* Limits for BSD Compatibility */
|
|
|
|
#define NL_TEXTMAX 2048
|
2011-08-06 01:02:43 +02:00
|
|
|
|
2011-04-27 23:42:16 +02:00
|
|
|
#include <sys/syslimits.h>
|
|
|
|
|
|
|
|
#endif /* _LIMITS_H */
|