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

Contents of /trunk/js/jsinttypes.h

Parent Directory Parent Directory | Revision Log Revision Log


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

1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* ***** BEGIN LICENSE BLOCK *****
3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
4 *
5 * The contents of this file are subject to the Mozilla Public License Version
6 * 1.1 (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 * http://www.mozilla.org/MPL/
9 *
10 * Software distributed under the License is distributed on an "AS IS" basis,
11 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 * for the specific language governing rights and limitations under the
13 * License.
14 *
15 * The Original Code is Mozilla SpiderMonkey JavaScript 1.9 code, released
16 * May 28, 2008.
17 *
18 * The Initial Developer of the Original Code is
19 * Jim Blandy <jimb@mozilla.org>
20 * Portions created by the Initial Developer are Copyright (C) 2009
21 * the Initial Developer. All Rights Reserved.
22 *
23 * Alternatively, the contents of this file may be used under the terms of
24 * either of the GNU General Public License Version 2 or later (the "GPL"),
25 * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
26 * in which case the provisions of the GPL or the LGPL are applicable instead
27 * of those above. If you wish to allow use of your version of this file only
28 * under the terms of either the GPL or the LGPL, and not to allow others to
29 * use your version of this file under the terms of the MPL, indicate your
30 * decision by deleting the provisions above and replace them with the notice
31 * and other provisions required by the GPL or the LGPL. If you do not delete
32 * the provisions above, a recipient may use your version of this file under
33 * the terms of any one of the MPL, the GPL or the LGPL.
34 *
35 * ***** END LICENSE BLOCK ***** */
36
37 #ifndef jsinttypes_h___
38 #define jsinttypes_h___
39
40 #include "js-config.h"
41
42 /*
43 * Types:
44 * JSInt<N>, JSUint<N> (for <N> = 8, 16, 32, and 64)
45 * JSIntPtr, JSUIntPtr
46 *
47 * JSInt<N> and JSUint<N> are signed and unsigned types known to be
48 * <N> bits long. Note that neither JSInt8 nor JSUInt8 is necessarily
49 * equivalent to a plain "char".
50 *
51 * JSIntPtr and JSUintPtr are signed and unsigned types capable of
52 * holding an object pointer.
53 *
54 * Use these types in public SpiderMonkey header files, not the
55 * corresponding types from the C standard <stdint.h> header. Windows
56 * doesn't support <stdint.h>, and Microsoft says it has no plans to
57 * do so in the future; this means that projects that embed
58 * SpiderMonkey often take matters into their own hands and define the
59 * standard types themselves. If we define them in our public
60 * headers, our definitions may conflict with embedders' (see bug
61 * 479258). The JS* types are in our namespace, and can be used
62 * without troubling anyone.
63 *
64 * Internal SpiderMonkey code wishing to use the type names ISO C
65 * defines in the standard header <stdint.h> can #include
66 * "jsstdint.h", which provides those types regardless of whether
67 * <stdint.h> itself is available.
68 */
69
70 #if defined(JS_HAVE_STDINT_H) || \
71 defined(JS_SYS_TYPES_H_DEFINES_EXACT_SIZE_TYPES)
72
73 #if defined(JS_HAVE_STDINT_H)
74 #include <stdint.h>
75 #else
76 #include <sys/types.h>
77 #endif
78
79 typedef int8_t JSInt8;
80 typedef int16_t JSInt16;
81 typedef int32_t JSInt32;
82 typedef int64_t JSInt64;
83 typedef intptr_t JSIntPtr;
84
85 typedef uint8_t JSUint8;
86 typedef uint16_t JSUint16;
87 typedef uint32_t JSUint32;
88 typedef uint64_t JSUint64;
89 typedef uintptr_t JSUintPtr;
90
91 #else
92
93 #if defined(JS_HAVE___INTN)
94
95 typedef __int8 JSInt8;
96 typedef __int16 JSInt16;
97 typedef __int32 JSInt32;
98 typedef __int64 JSInt64;
99
100 typedef unsigned __int8 JSUint8;
101 typedef unsigned __int16 JSUint16;
102 typedef unsigned __int32 JSUint32;
103 typedef unsigned __int64 JSUint64;
104
105 #elif defined(JS_INT8_TYPE)
106
107 typedef signed JS_INT8_TYPE JSInt8;
108 typedef signed JS_INT16_TYPE JSInt16;
109 typedef signed JS_INT32_TYPE JSInt32;
110 typedef signed JS_INT64_TYPE JSInt64;
111
112 typedef unsigned JS_INT8_TYPE JSUint8;
113 typedef unsigned JS_INT16_TYPE JSUint16;
114 typedef unsigned JS_INT32_TYPE JSUint32;
115 typedef unsigned JS_INT64_TYPE JSUint64;
116
117 #else
118 #error "couldn't find exact-width integer types"
119 #endif
120
121 /* Microsoft Visual C/C++ defines intptr_t and uintptr_t in <stddef.h>. */
122 #if defined(JS_STDDEF_H_HAS_INTPTR_T)
123 #include <stddef.h>
124 typedef intptr_t JSIntPtr;
125 typedef uintptr_t JSUintPtr;
126
127 /* Windows Mobile defines intptr_t and uintptr_t in <crtdefs.h>. Why not? */
128 #elif defined(JS_CRTDEFS_H_HAS_INTPTR_T)
129 #include <crtdefs.h>
130 typedef intptr_t JSIntPtr;
131 typedef uintptr_t JSUintPtr;
132
133 /* Failing that, the configure script will have found something. */
134 #elif defined(JS_INTPTR_TYPE)
135 typedef signed JS_INTPTR_TYPE JSIntPtr;
136 typedef unsigned JS_INTPTR_TYPE JSUintPtr;
137
138 #else
139 #error "couldn't find pointer-sized integer types"
140 #endif
141
142 #endif /* JS_HAVE_STDINT_H */
143
144 #endif /* jsinttypes_h___ */

  ViewVC Help
Powered by ViewVC 1.1.24