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

Annotation of /trunk/js/jsinttypes.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 507 - (hide annotations)
Sun Jan 10 07:23:34 2010 UTC (10 years, 9 months ago) by siliconforks
File MIME type: text/plain
File size: 4755 byte(s)
Update SpiderMonkey from Firefox 3.6rc1.

1 siliconforks 507 /* -*- 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    
72     #include <stdint.h>
73    
74     typedef int8_t JSInt8;
75     typedef int16_t JSInt16;
76     typedef int32_t JSInt32;
77     typedef int64_t JSInt64;
78     typedef intptr_t JSIntPtr;
79    
80     typedef uint8_t JSUint8;
81     typedef uint16_t JSUint16;
82     typedef uint32_t JSUint32;
83     typedef uint64_t JSUint64;
84     typedef uintptr_t JSUintPtr;
85    
86     #else
87    
88     #if defined(JS_HAVE___INTN)
89    
90     typedef __int8 JSInt8;
91     typedef __int16 JSInt16;
92     typedef __int32 JSInt32;
93     typedef __int64 JSInt64;
94    
95     typedef unsigned __int8 JSUint8;
96     typedef unsigned __int16 JSUint16;
97     typedef unsigned __int32 JSUint32;
98     typedef unsigned __int64 JSUint64;
99    
100     #elif defined(JS_INT8_TYPE)
101    
102     typedef signed JS_INT8_TYPE JSInt8;
103     typedef signed JS_INT16_TYPE JSInt16;
104     typedef signed JS_INT32_TYPE JSInt32;
105     typedef signed JS_INT64_TYPE JSInt64;
106    
107     typedef unsigned JS_INT8_TYPE JSUint8;
108     typedef unsigned JS_INT16_TYPE JSUint16;
109     typedef unsigned JS_INT32_TYPE JSUint32;
110     typedef unsigned JS_INT64_TYPE JSUint64;
111    
112     #else
113     #error "couldn't find exact-width integer types"
114     #endif
115    
116     /* Microsoft Visual C/C++ defines intptr_t and uintptr_t in <stddef.h>. */
117     #if defined(JS_STDDEF_H_HAS_INTPTR_T)
118     #include <stddef.h>
119     typedef intptr_t JSIntPtr;
120     typedef uintptr_t JSUintPtr;
121    
122     /* Windows Mobile defines intptr_t and uintptr_t in <crtdefs.h>. Why not? */
123     #elif defined(JS_CRTDEFS_H_HAS_INTPTR_T)
124     #include <crtdefs.h>
125     typedef intptr_t JSIntPtr;
126     typedef uintptr_t JSUintPtr;
127    
128     /* Failing that, the configure script will have found something. */
129     #elif defined(JS_INTPTR_TYPE)
130     typedef signed JS_INTPTR_TYPE JSIntPtr;
131     typedef unsigned JS_INTPTR_TYPE JSUintPtr;
132    
133     #else
134     #error "couldn't find pointer-sized integer types"
135     #endif
136    
137     #endif /* JS_HAVE_STDINT_H */
138    
139     #endif /* jsinttypes_h___ */

  ViewVC Help
Powered by ViewVC 1.1.24