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
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/
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
15 * The Original Code is the Netscape Portable Runtime (NSPR).
17 * The Initial Developer of the Original Code is
18 * Netscape Communications Corporation.
19 * Portions created by the Initial Developer are Copyright (C) 1998-2000
20 * the Initial Developer. All Rights Reserved.
24 * Alternatively, the contents of this file may be used under the terms of
25 * either the GNU General Public License Version 2 or later (the "GPL"), or
26 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
27 * in which case the provisions of the GPL or the LGPL are applicable instead
28 * of those above. If you wish to allow use of your version of this file only
29 * under the terms of either the GPL or the LGPL, and not to allow others to
30 * use your version of this file under the terms of the MPL, indicate your
31 * decision by deleting the provisions above and replace them with the notice
32 * and other provisions required by the GPL or the LGPL. If you do not delete
33 * the provisions above, a recipient may use your version of this file under
34 * the terms of any one of the MPL, the GPL or the LGPL.
36 * ***** END LICENSE BLOCK ***** */
38 #ifndef nspr_cpucfg___
39 #define nspr_cpucfg___
59 #define PR_AF_INET6 23 /* same as AF_INET6 */
61 #if defined(_M_IX86) || defined(_X86_)
63 #define IS_LITTLE_ENDIAN 1
66 #define PR_BYTES_PER_BYTE 1
67 #define PR_BYTES_PER_SHORT 2
68 #define PR_BYTES_PER_INT 4
69 #define PR_BYTES_PER_INT64 8
70 #define PR_BYTES_PER_LONG 4
71 #define PR_BYTES_PER_FLOAT 4
72 #define PR_BYTES_PER_WORD 4
73 #define PR_BYTES_PER_DWORD 8
74 #define PR_BYTES_PER_DOUBLE 8
76 #define PR_BITS_PER_BYTE 8
77 #define PR_BITS_PER_SHORT 16
78 #define PR_BITS_PER_INT 32
79 #define PR_BITS_PER_INT64 64
80 #define PR_BITS_PER_LONG 32
81 #define PR_BITS_PER_FLOAT 32
82 #define PR_BITS_PER_WORD 32
83 #define PR_BITS_PER_DWORD 64
84 #define PR_BITS_PER_DOUBLE 64
86 #define PR_BITS_PER_BYTE_LOG2 3
87 #define PR_BITS_PER_SHORT_LOG2 4
88 #define PR_BITS_PER_INT_LOG2 5
89 #define PR_BITS_PER_INT64_LOG2 6
90 #define PR_BITS_PER_LONG_LOG2 5
91 #define PR_BITS_PER_FLOAT_LOG2 5
92 #define PR_BITS_PER_WORD_LOG2 5
93 #define PR_BITS_PER_DWORD_LOG2 6
94 #define PR_BITS_PER_DOUBLE_LOG2 6
96 #define PR_ALIGN_OF_SHORT 2
97 #define PR_ALIGN_OF_INT 4
98 #define PR_ALIGN_OF_LONG 4
99 #define PR_ALIGN_OF_INT64 8
100 #define PR_ALIGN_OF_FLOAT 4
101 #define PR_ALIGN_OF_WORD 4
102 #define PR_ALIGN_OF_DWORD 8
103 #define PR_ALIGN_OF_DOUBLE 4
104 #define PR_ALIGN_OF_POINTER 4
106 #define PR_BYTES_PER_WORD_LOG2 2
107 #define PR_BYTES_PER_DWORD_LOG2 3
109 #elif defined(_ALPHA_)
111 #define IS_LITTLE_ENDIAN 1
114 #define PR_BYTES_PER_BYTE 1
115 #define PR_BYTES_PER_SHORT 2
116 #define PR_BYTES_PER_INT 4
117 #define PR_BYTES_PER_INT64 8
118 #define PR_BYTES_PER_LONG 4
119 #define PR_BYTES_PER_FLOAT 4
120 #define PR_BYTES_PER_DOUBLE 8
121 #define PR_BYTES_PER_WORD 4
122 #define PR_BYTES_PER_DWORD 8
124 #define PR_BITS_PER_BYTE 8
125 #define PR_BITS_PER_SHORT 16
126 #define PR_BITS_PER_INT 32
127 #define PR_BITS_PER_INT64 64
128 #define PR_BITS_PER_LONG 32
129 #define PR_BITS_PER_FLOAT 32
130 #define PR_BITS_PER_DOUBLE 64
131 #define PR_BITS_PER_WORD 32
133 #define PR_BITS_PER_BYTE_LOG2 3
134 #define PR_BITS_PER_SHORT_LOG2 4
135 #define PR_BITS_PER_INT_LOG2 5
136 #define PR_BITS_PER_INT64_LOG2 6
137 #define PR_BITS_PER_LONG_LOG2 5
138 #define PR_BITS_PER_FLOAT_LOG2 5
139 #define PR_BITS_PER_DOUBLE_LOG2 6
140 #define PR_BITS_PER_WORD_LOG2 5
142 #define PR_BYTES_PER_WORD_LOG2 2
143 #define PR_BYTES_PER_DWORD_LOG2 3
145 #define PR_ALIGN_OF_SHORT 2
146 #define PR_ALIGN_OF_INT 4
147 #define PR_ALIGN_OF_LONG 4
148 #define PR_ALIGN_OF_INT64 8
149 #define PR_ALIGN_OF_FLOAT 4
150 #define PR_ALIGN_OF_DOUBLE 8
151 #define PR_ALIGN_OF_POINTER 4
153 #elif defined(_AMD64_)
155 #define IS_LITTLE_ENDIAN 1
159 #define PR_BYTES_PER_BYTE 1
160 #define PR_BYTES_PER_SHORT 2
161 #define PR_BYTES_PER_INT 4
162 #define PR_BYTES_PER_INT64 8
163 #define PR_BYTES_PER_LONG 4
164 #define PR_BYTES_PER_FLOAT 4
165 #define PR_BYTES_PER_WORD 8
166 #define PR_BYTES_PER_DWORD 8
167 #define PR_BYTES_PER_DOUBLE 8
169 #define PR_BITS_PER_BYTE 8
170 #define PR_BITS_PER_SHORT 16
171 #define PR_BITS_PER_INT 32
172 #define PR_BITS_PER_INT64 64
173 #define PR_BITS_PER_LONG 32
174 #define PR_BITS_PER_FLOAT 32
175 #define PR_BITS_PER_WORD 64
176 #define PR_BITS_PER_DWORD 64
177 #define PR_BITS_PER_DOUBLE 64
179 #define PR_BITS_PER_BYTE_LOG2 3
180 #define PR_BITS_PER_SHORT_LOG2 4
181 #define PR_BITS_PER_INT_LOG2 5
182 #define PR_BITS_PER_INT64_LOG2 6
183 #define PR_BITS_PER_LONG_LOG2 5
184 #define PR_BITS_PER_FLOAT_LOG2 5
185 #define PR_BITS_PER_WORD_LOG2 6
186 #define PR_BITS_PER_DWORD_LOG2 6
187 #define PR_BITS_PER_DOUBLE_LOG2 6
189 #define PR_ALIGN_OF_SHORT 2
190 #define PR_ALIGN_OF_INT 4
191 #define PR_ALIGN_OF_LONG 4
192 #define PR_ALIGN_OF_INT64 8
193 #define PR_ALIGN_OF_FLOAT 4
194 #define PR_ALIGN_OF_WORD 8
195 #define PR_ALIGN_OF_DWORD 8
196 #define PR_ALIGN_OF_DOUBLE 8
197 #define PR_ALIGN_OF_POINTER 8
199 #define PR_BYTES_PER_WORD_LOG2 3
200 #define PR_BYTES_PER_DWORD_LOG2 3
202 #elif defined(_IA64_)
204 #define IS_LITTLE_ENDIAN 1
208 #define PR_BYTES_PER_BYTE 1
209 #define PR_BYTES_PER_SHORT 2
210 #define PR_BYTES_PER_INT 4
211 #define PR_BYTES_PER_INT64 8
212 #define PR_BYTES_PER_LONG 4
213 #define PR_BYTES_PER_FLOAT 4
214 #define PR_BYTES_PER_WORD 8
215 #define PR_BYTES_PER_DWORD 8
216 #define PR_BYTES_PER_DOUBLE 8
218 #define PR_BITS_PER_BYTE 8
219 #define PR_BITS_PER_SHORT 16
220 #define PR_BITS_PER_INT 32
221 #define PR_BITS_PER_INT64 64
222 #define PR_BITS_PER_LONG 32
223 #define PR_BITS_PER_FLOAT 32
224 #define PR_BITS_PER_WORD 64
225 #define PR_BITS_PER_DWORD 64
226 #define PR_BITS_PER_DOUBLE 64
228 #define PR_BITS_PER_BYTE_LOG2 3
229 #define PR_BITS_PER_SHORT_LOG2 4
230 #define PR_BITS_PER_INT_LOG2 5
231 #define PR_BITS_PER_INT64_LOG2 6
232 #define PR_BITS_PER_LONG_LOG2 5
233 #define PR_BITS_PER_FLOAT_LOG2 5
234 #define PR_BITS_PER_WORD_LOG2 6
235 #define PR_BITS_PER_DWORD_LOG2 6
236 #define PR_BITS_PER_DOUBLE_LOG2 6
238 #define PR_ALIGN_OF_SHORT 2
239 #define PR_ALIGN_OF_INT 4
240 #define PR_ALIGN_OF_LONG 4
241 #define PR_ALIGN_OF_INT64 8
242 #define PR_ALIGN_OF_FLOAT 4
243 #define PR_ALIGN_OF_WORD 8
244 #define PR_ALIGN_OF_DWORD 8
245 #define PR_ALIGN_OF_DOUBLE 8
246 #define PR_ALIGN_OF_POINTER 8
248 #define PR_BYTES_PER_WORD_LOG2 3
249 #define PR_BYTES_PER_DWORD_LOG2 3
253 #define IS_LITTLE_ENDIAN 1
256 #define PR_BYTES_PER_BYTE 1
257 #define PR_BYTES_PER_SHORT 2
258 #define PR_BYTES_PER_INT 4
259 #define PR_BYTES_PER_INT64 8
260 #define PR_BYTES_PER_LONG 4
261 #define PR_BYTES_PER_FLOAT 4
262 #define PR_BYTES_PER_WORD 4
263 #define PR_BYTES_PER_DWORD 8
264 #define PR_BYTES_PER_DOUBLE 8
266 #define PR_BITS_PER_BYTE 8
267 #define PR_BITS_PER_SHORT 16
268 #define PR_BITS_PER_INT 32
269 #define PR_BITS_PER_INT64 64
270 #define PR_BITS_PER_LONG 32
271 #define PR_BITS_PER_FLOAT 32
272 #define PR_BITS_PER_WORD 32
273 #define PR_BITS_PER_DWORD 64
274 #define PR_BITS_PER_DOUBLE 64
276 #define PR_BITS_PER_BYTE_LOG2 3
277 #define PR_BITS_PER_SHORT_LOG2 4
278 #define PR_BITS_PER_INT_LOG2 5
279 #define PR_BITS_PER_INT64_LOG2 6
280 #define PR_BITS_PER_LONG_LOG2 5
281 #define PR_BITS_PER_FLOAT_LOG2 5
282 #define PR_BITS_PER_WORD_LOG2 5
283 #define PR_BITS_PER_DWORD_LOG2 6
284 #define PR_BITS_PER_DOUBLE_LOG2 6
286 #define PR_ALIGN_OF_SHORT 2
287 #define PR_ALIGN_OF_INT 4
288 #define PR_ALIGN_OF_LONG 4
289 #define PR_ALIGN_OF_INT64 8
290 #define PR_ALIGN_OF_FLOAT 4
291 #define PR_ALIGN_OF_WORD 4
292 #define PR_ALIGN_OF_DWORD 8
293 #define PR_ALIGN_OF_DOUBLE 4
294 #define PR_ALIGN_OF_POINTER 4
296 #define PR_BYTES_PER_WORD_LOG2 2
297 #define PR_BYTES_PER_DWORD_LOG2 3
299 #else /* defined(_M_IX86) || defined(_X86_) */
301 #error unknown processor architecture
303 #endif /* defined(_M_IX86) || defined(_X86_) */
305 #ifndef HAVE_LONG_LONG
306 #define HAVE_LONG_LONG
309 #ifndef NO_NSPR_10_SUPPORT
311 #define BYTES_PER_BYTE PR_BYTES_PER_BYTE
312 #define BYTES_PER_SHORT PR_BYTES_PER_SHORT
313 #define BYTES_PER_INT PR_BYTES_PER_INT
314 #define BYTES_PER_INT64 PR_BYTES_PER_INT64
315 #define BYTES_PER_LONG PR_BYTES_PER_LONG
316 #define BYTES_PER_FLOAT PR_BYTES_PER_FLOAT
317 #define BYTES_PER_DOUBLE PR_BYTES_PER_DOUBLE
318 #define BYTES_PER_WORD PR_BYTES_PER_WORD
319 #define BYTES_PER_DWORD PR_BYTES_PER_DWORD
321 #define BITS_PER_BYTE PR_BITS_PER_BYTE
322 #define BITS_PER_SHORT PR_BITS_PER_SHORT
323 #define BITS_PER_INT PR_BITS_PER_INT
324 #define BITS_PER_INT64 PR_BITS_PER_INT64
325 #define BITS_PER_LONG PR_BITS_PER_LONG
326 #define BITS_PER_FLOAT PR_BITS_PER_FLOAT
327 #define BITS_PER_DOUBLE PR_BITS_PER_DOUBLE
328 #define BITS_PER_WORD PR_BITS_PER_WORD
330 #define BITS_PER_BYTE_LOG2 PR_BITS_PER_BYTE_LOG2
331 #define BITS_PER_SHORT_LOG2 PR_BITS_PER_SHORT_LOG2
332 #define BITS_PER_INT_LOG2 PR_BITS_PER_INT_LOG2
333 #define BITS_PER_INT64_LOG2 PR_BITS_PER_INT64_LOG2
334 #define BITS_PER_LONG_LOG2 PR_BITS_PER_LONG_LOG2
335 #define BITS_PER_FLOAT_LOG2 PR_BITS_PER_FLOAT_LOG2
336 #define BITS_PER_DOUBLE_LOG2 PR_BITS_PER_DOUBLE_LOG2
337 #define BITS_PER_WORD_LOG2 PR_BITS_PER_WORD_LOG2
339 #define ALIGN_OF_SHORT PR_ALIGN_OF_SHORT
340 #define ALIGN_OF_INT PR_ALIGN_OF_INT
341 #define ALIGN_OF_LONG PR_ALIGN_OF_LONG
342 #define ALIGN_OF_INT64 PR_ALIGN_OF_INT64
343 #define ALIGN_OF_FLOAT PR_ALIGN_OF_FLOAT
344 #define ALIGN_OF_DOUBLE PR_ALIGN_OF_DOUBLE
345 #define ALIGN_OF_POINTER PR_ALIGN_OF_POINTER
346 #define ALIGN_OF_WORD PR_ALIGN_OF_WORD
348 #define BYTES_PER_WORD_LOG2 PR_BYTES_PER_WORD_LOG2
349 #define BYTES_PER_DWORD_LOG2 PR_BYTES_PER_DWORD_LOG2
350 #define WORDS_PER_DWORD_LOG2 PR_WORDS_PER_DWORD_LOG2
352 #endif /* NO_NSPR_10_SUPPORT */
354 #endif /* nspr_cpucfg___ */