/[jscoverage]/trunk/js/jsstdint.h
ViewVC logotype

Contents of /trunk/js/jsstdint.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 535 - (show annotations)
Fri Apr 2 16:18:55 2010 UTC (9 years, 3 months ago) by siliconforks
File MIME type: text/plain
File size: 4235 byte(s)
Update SpiderMonkey from Firefox 3.6.2.

1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2 * vim: set ts=8 sw=4 et tw=78:
3 *
4 * ***** BEGIN LICENSE BLOCK *****
5 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
6 *
7 * The contents of this file are subject to the Mozilla Public License Version
8 * 1.1 (the "License"); you may not use this file except in compliance with
9 * the License. You may obtain a copy of the License at
10 * http://www.mozilla.org/MPL/
11 *
12 * Software distributed under the License is distributed on an "AS IS" basis,
13 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
14 * for the specific language governing rights and limitations under the
15 * License.
16 *
17 * The Original Code is mozilla.org code.
18 *
19 * The Initial Developer of the Original Code is
20 * Jim Blandy
21 * Portions created by the Initial Developer are Copyright (C) 2008
22 * the Initial Developer. All Rights Reserved.
23 *
24 * Contributor(s):
25 *
26 * Alternatively, the contents of this file may be used under the terms of
27 * either of the GNU General Public License Version 2 or later (the "GPL"),
28 * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
29 * in which case the provisions of the GPL or the LGPL are applicable instead
30 * of those above. If you wish to allow use of your version of this file only
31 * under the terms of either the GPL or the LGPL, and not to allow others to
32 * use your version of this file under the terms of the MPL, indicate your
33 * decision by deleting the provisions above and replace them with the notice
34 * and other provisions required by the GPL or the LGPL. If you do not delete
35 * the provisions above, a recipient may use your version of this file under
36 * the terms of any one of the MPL, the GPL or the LGPL.
37 *
38 * ***** END LICENSE BLOCK ***** */
39
40 /*
41 * This header provides definitions for the <stdint.h> types we use,
42 * even on systems that lack <stdint.h>.
43 *
44 * NOTE: This header should only be included in private SpiderMonkey
45 * code; public headers should use only the JS{Int,Uint}N types; see
46 * the comment for them in "jsinttypes.h".
47 *
48 * At the moment, these types are not widely used within SpiderMonkey;
49 * this file is meant to make existing uses portable, and to allow us
50 * to transition portably to using them more, if desired.
51 */
52
53 #ifndef jsstdint_h___
54 #define jsstdint_h___
55
56 #include "jsinttypes.h"
57
58 /* If we have a working stdint.h, then jsinttypes.h has already
59 defined the standard integer types. Otherwise, define the standard
60 names in terms of the 'JS' types. */
61 #if ! defined(JS_HAVE_STDINT_H) && \
62 ! defined(JS_SYS_TYPES_H_DEFINES_EXACT_SIZE_TYPES)
63
64 typedef JSInt8 int8_t;
65 typedef JSInt16 int16_t;
66 typedef JSInt32 int32_t;
67 typedef JSInt64 int64_t;
68
69 typedef JSUint8 uint8_t;
70 typedef JSUint16 uint16_t;
71 typedef JSUint32 uint32_t;
72 typedef JSUint64 uint64_t;
73
74 /* If JS_STDDEF_H_HAS_INTPTR_T or JS_CRTDEFS_H_HAS_INTPTR_T are
75 defined, then jsinttypes.h included the given header, which
76 introduced definitions for intptr_t and uintptr_t. Otherwise,
77 define the standard names in terms of the 'JS' types. */
78 #if !defined(JS_STDDEF_H_HAS_INTPTR_T) && !defined(JS_CRTDEFS_H_HAS_INTPTR_T)
79 typedef JSIntPtr intptr_t;
80 typedef JSUintPtr uintptr_t;
81 #endif
82
83 #if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS)
84
85 #define INT8_MAX 127
86 #define INT8_MIN (-INT8_MAX - 1)
87 #define INT16_MAX 32767
88 #define INT16_MIN (-INT16_MAX - 1)
89 #define INT32_MAX 2147483647
90 #define INT32_MIN (-INT32_MAX - 1)
91 #define INT64_MAX 9223372036854775807LL
92 #define INT64_MIN (-INT64_MAX - 1)
93
94 #define UINT8_MAX 255
95 #define UINT16_MAX 65535
96 #define UINT32_MAX 4294967295U
97 #define UINT64_MAX 18446744073709551615ULL
98
99 /*
100 * These are technically wrong as they can't be used in the preprocessor, but
101 * we would require compiler assistance, and at the moment we don't need
102 * preprocessor-correctness.
103 */
104 #define INTPTR_MAX ((intptr_t) (UINTPTR_MAX >> 1))
105 #define INTPTR_MIN (intptr_t(uintptr_t(INTPTR_MAX) + uintptr_t(1)))
106 #define UINTPTR_MAX ((uintptr_t) -1)
107 #define SIZE_MAX UINTPTR_MAX
108 #define PTRDIFF_MAX INTPTR_MAX
109 #define PTRDIFF_MIN INTPTR_MIN
110
111 #endif /* !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS) */
112
113 #endif /* JS_HAVE_STDINT_H */
114
115 #endif /* jsstdint_h___ */

  ViewVC Help
Powered by ViewVC 1.1.24