1 | /** @file
|
---|
2 | * IPRT / No-CRT - Our own limits header.
|
---|
3 | */
|
---|
4 |
|
---|
5 | /*
|
---|
6 | * Copyright (C) 2006-2010 Oracle Corporation
|
---|
7 | *
|
---|
8 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
9 | * available from http://www.virtualbox.org. This file is free software;
|
---|
10 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
11 | * General Public License (GPL) as published by the Free Software
|
---|
12 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
13 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
14 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
15 | *
|
---|
16 | * The contents of this file may alternatively be used under the terms
|
---|
17 | * of the Common Development and Distribution License Version 1.0
|
---|
18 | * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
|
---|
19 | * VirtualBox OSE distribution, in which case the provisions of the
|
---|
20 | * CDDL are applicable instead of those of the GPL.
|
---|
21 | *
|
---|
22 | * You may elect to license modified versions of this file under the
|
---|
23 | * terms and conditions of either the GPL or the CDDL or both.
|
---|
24 | */
|
---|
25 |
|
---|
26 | #ifndef ___iprt_nocrt_limits_h
|
---|
27 | #define ___iprt_nocrt_limits_h
|
---|
28 |
|
---|
29 | #include <iprt/types.h>
|
---|
30 |
|
---|
31 | #define CHAR_BIT 8
|
---|
32 | #define SCHAR_MAX 0x7f
|
---|
33 | #define SCHAR_MIN (-0x7f - 1)
|
---|
34 | #define UCHAR_MAX 0xff
|
---|
35 | #if 1 /* ASSUMES: signed char */
|
---|
36 | # define CHAR_MAX SCHAR_MAX
|
---|
37 | # define CHAR_MIN SCHAR_MIN
|
---|
38 | #else
|
---|
39 | # define CHAR_MAX UCHAR_MAX
|
---|
40 | # define CHAR_MIN 0
|
---|
41 | #endif
|
---|
42 |
|
---|
43 | #define WORD_BIT 16
|
---|
44 | #define USHRT_MAX 0xffff
|
---|
45 | #define SHRT_MAX 0x7fff
|
---|
46 | #define SHRT_MIN (-0x7fff - 1)
|
---|
47 |
|
---|
48 | /* ASSUMES 32-bit int */
|
---|
49 | #define UINT_MAX 0xffffffffU
|
---|
50 | #define INT_MAX 0x7fffffff
|
---|
51 | #define INT_MIN (-0x7fffffff - 1)
|
---|
52 |
|
---|
53 | #if defined(RT_ARCH_X86) || defined(RT_OS_WINDOWS) || defined(RT_ARCH_SPARC)
|
---|
54 | # define LONG_BIT 32
|
---|
55 | # define ULONG_MAX 0xffffffffU
|
---|
56 | # define LONG_MAX 0x7fffffff
|
---|
57 | # define LONG_MIN (-0x7fffffff - 1)
|
---|
58 | #elif defined(RT_ARCH_AMD64) || defined(RT_ARCH_SPARC64)
|
---|
59 | # define LONG_BIT 64
|
---|
60 | # define ULONG_MAX UINT64_C(0xffffffffffffffff)
|
---|
61 | # define LONG_MAX INT64_C(0x7fffffffffffffff)
|
---|
62 | # define LONG_MIN (INT64_C(-0x7fffffffffffffff) - 1)
|
---|
63 | #else
|
---|
64 | # error "PORTME"
|
---|
65 | #endif
|
---|
66 |
|
---|
67 | #define LLONG_BIT 64
|
---|
68 | #define ULLONG_MAX UINT64_C(0xffffffffffffffff)
|
---|
69 | #define LLONG_MAX INT64_C(0x7fffffffffffffff)
|
---|
70 | #define LLONG_MIN (INT64_C(-0x7fffffffffffffff) - 1)
|
---|
71 |
|
---|
72 | #if ARCH_BITS == 32
|
---|
73 | # define SIZE_T_MAX 0xffffffffU
|
---|
74 | # define SSIZE_MAX 0x7fffffff
|
---|
75 | #elif ARCH_BITS == 64
|
---|
76 | # define SIZE_T_MAX UINT64_C(0xffffffffffffffff)
|
---|
77 | # define SSIZE_MAX INT64_C(0x7fffffffffffffff)
|
---|
78 | #else
|
---|
79 | # error "huh?"
|
---|
80 | #endif
|
---|
81 |
|
---|
82 | /*#define OFF_MAX __OFF_MAX
|
---|
83 | #define OFF_MIN __OFF_MIN*/
|
---|
84 |
|
---|
85 | #endif
|
---|
86 |
|
---|