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___
49 #define PR_AF_INET6 24 /* same as AF_INET6 */
51 #ifndef HAVE_LONG_LONG
52 #define HAVE_LONG_LONG
55 #if defined(__i386__) || defined(__arm__)
57 #define IS_LITTLE_ENDIAN 1
59 #undef HAVE_ALIGNED_DOUBLES
60 #undef HAVE_ALIGNED_LONGLONGS
62 #define PR_BYTES_PER_BYTE 1
63 #define PR_BYTES_PER_SHORT 2
64 #define PR_BYTES_PER_INT 4
65 #define PR_BYTES_PER_INT64 8
66 #define PR_BYTES_PER_LONG 4
67 #define PR_BYTES_PER_FLOAT 4
68 #define PR_BYTES_PER_DOUBLE 8
69 #define PR_BYTES_PER_WORD 4
70 #define PR_BYTES_PER_DWORD 8
71 #define PR_BYTES_PER_WORD_LOG2 2
72 #define PR_BYTES_PER_DWORD_LOG2 3
74 #define PR_BITS_PER_BYTE 8
75 #define PR_BITS_PER_SHORT 16
76 #define PR_BITS_PER_INT 32
77 #define PR_BITS_PER_INT64 64
78 #define PR_BITS_PER_LONG 32
79 #define PR_BITS_PER_FLOAT 32
80 #define PR_BITS_PER_DOUBLE 64
81 #define PR_BITS_PER_WORD 32
83 #define PR_BITS_PER_BYTE_LOG2 3
84 #define PR_BITS_PER_SHORT_LOG2 4
85 #define PR_BITS_PER_INT_LOG2 5
86 #define PR_BITS_PER_INT64_LOG2 6
87 #define PR_BITS_PER_LONG_LOG2 5
88 #define PR_BITS_PER_FLOAT_LOG2 5
89 #define PR_BITS_PER_DOUBLE_LOG2 6
90 #define PR_BITS_PER_WORD_LOG2 5
92 #define PR_ALIGN_OF_SHORT 2
93 #define PR_ALIGN_OF_INT 4
94 #define PR_ALIGN_OF_LONG 4
95 #define PR_ALIGN_OF_INT64 4
96 #define PR_ALIGN_OF_FLOAT 4
97 #define PR_ALIGN_OF_DOUBLE 4
98 #define PR_ALIGN_OF_POINTER 4
100 #elif defined(__amd64__)
102 #define IS_LITTLE_ENDIAN 1
106 #define PR_BYTES_PER_BYTE 1
107 #define PR_BYTES_PER_SHORT 2
108 #define PR_BYTES_PER_INT 4
109 #define PR_BYTES_PER_INT64 8
110 #define PR_BYTES_PER_LONG 8
111 #define PR_BYTES_PER_FLOAT 4
112 #define PR_BYTES_PER_DOUBLE 8
113 #define PR_BYTES_PER_WORD 8
114 #define PR_BYTES_PER_DWORD 8
116 #define PR_BITS_PER_BYTE 8
117 #define PR_BITS_PER_SHORT 16
118 #define PR_BITS_PER_INT 32
119 #define PR_BITS_PER_INT64 64
120 #define PR_BITS_PER_LONG 64
121 #define PR_BITS_PER_FLOAT 32
122 #define PR_BITS_PER_DOUBLE 64
123 #define PR_BITS_PER_WORD 64
125 #define PR_BITS_PER_BYTE_LOG2 3
126 #define PR_BITS_PER_SHORT_LOG2 4
127 #define PR_BITS_PER_INT_LOG2 5
128 #define PR_BITS_PER_INT64_LOG2 6
129 #define PR_BITS_PER_LONG_LOG2 6
130 #define PR_BITS_PER_FLOAT_LOG2 5
131 #define PR_BITS_PER_DOUBLE_LOG2 6
132 #define PR_BITS_PER_WORD_LOG2 6
134 #define PR_ALIGN_OF_SHORT 2
135 #define PR_ALIGN_OF_INT 4
136 #define PR_ALIGN_OF_LONG 8
137 #define PR_ALIGN_OF_INT64 8
138 #define PR_ALIGN_OF_FLOAT 4
139 #define PR_ALIGN_OF_DOUBLE 8
140 #define PR_ALIGN_OF_POINTER 8
141 #define PR_ALIGN_OF_WORD 8
143 #define PR_BYTES_PER_WORD_LOG2 3
144 #define PR_BYTES_PER_DWORD_LOG2 3
146 #define HAVE_ALIGNED_DOUBLES
147 #define HAVE_ALIGNED_LONGLONGS
149 #elif defined(__sparc_v9__)
151 #undef IS_LITTLE_ENDIAN
152 #define IS_BIG_ENDIAN 1
153 #define HAVE_ALIGNED_DOUBLES
154 #define HAVE_ALIGNED_LONGLONGS
157 #define PR_BYTES_PER_BYTE 1
158 #define PR_BYTES_PER_SHORT 2
159 #define PR_BYTES_PER_INT 4
160 #define PR_BYTES_PER_INT64 8
161 #define PR_BYTES_PER_LONG 8
162 #define PR_BYTES_PER_FLOAT 4
163 #define PR_BYTES_PER_DOUBLE 8
164 #define PR_BYTES_PER_WORD 8
165 #define PR_BYTES_PER_DWORD 8
167 #define PR_BITS_PER_BYTE 8
168 #define PR_BITS_PER_SHORT 16
169 #define PR_BITS_PER_INT 32
170 #define PR_BITS_PER_INT64 64
171 #define PR_BITS_PER_LONG 64
172 #define PR_BITS_PER_FLOAT 32
173 #define PR_BITS_PER_DOUBLE 64
174 #define PR_BITS_PER_WORD 64
176 #define PR_BITS_PER_BYTE_LOG2 3
177 #define PR_BITS_PER_SHORT_LOG2 4
178 #define PR_BITS_PER_INT_LOG2 5
179 #define PR_BITS_PER_INT64_LOG2 6
180 #define PR_BITS_PER_LONG_LOG2 6
181 #define PR_BITS_PER_FLOAT_LOG2 5
182 #define PR_BITS_PER_DOUBLE_LOG2 6
183 #define PR_BITS_PER_WORD_LOG2 6
185 #define PR_ALIGN_OF_SHORT 2
186 #define PR_ALIGN_OF_INT 4
187 #define PR_ALIGN_OF_LONG 8
188 #define PR_ALIGN_OF_INT64 8
189 #define PR_ALIGN_OF_FLOAT 4
190 #define PR_ALIGN_OF_DOUBLE 8
191 #define PR_ALIGN_OF_POINTER 8
193 #define PR_BYTES_PER_WORD_LOG2 3
194 #define PR_BYTES_PER_DWORD_LOG2 3
196 #elif defined(__sparc__)
198 #undef IS_LITTLE_ENDIAN
199 #define IS_BIG_ENDIAN 1
200 #define HAVE_ALIGNED_DOUBLES
201 #define HAVE_ALIGNED_LONGLONGS
203 #define PR_BYTES_PER_BYTE 1
204 #define PR_BYTES_PER_SHORT 2
205 #define PR_BYTES_PER_INT 4
206 #define PR_BYTES_PER_INT64 8
207 #define PR_BYTES_PER_LONG 4
208 #define PR_BYTES_PER_FLOAT 4
209 #define PR_BYTES_PER_DOUBLE 8
210 #define PR_BYTES_PER_WORD 4
211 #define PR_BYTES_PER_DWORD 8
212 #define PR_BYTES_PER_WORD_LOG2 2
213 #define PR_BYTES_PER_DWORD_LOG2 3
215 #define PR_BITS_PER_BYTE 8
216 #define PR_BITS_PER_SHORT 16
217 #define PR_BITS_PER_INT 32
218 #define PR_BITS_PER_INT64 64
219 #define PR_BITS_PER_LONG 32
220 #define PR_BITS_PER_FLOAT 32
221 #define PR_BITS_PER_DOUBLE 64
222 #define PR_BITS_PER_WORD 32
224 #define PR_BITS_PER_BYTE_LOG2 3
225 #define PR_BITS_PER_SHORT_LOG2 4
226 #define PR_BITS_PER_INT_LOG2 5
227 #define PR_BITS_PER_INT64_LOG2 6
228 #define PR_BITS_PER_LONG_LOG2 5
229 #define PR_BITS_PER_FLOAT_LOG2 5
230 #define PR_BITS_PER_DOUBLE_LOG2 6
231 #define PR_BITS_PER_WORD_LOG2 5
233 #define PR_ALIGN_OF_SHORT 2
234 #define PR_ALIGN_OF_INT 4
235 #define PR_ALIGN_OF_LONG 4
236 #define PR_ALIGN_OF_INT64 8
237 #define PR_ALIGN_OF_FLOAT 4
238 #define PR_ALIGN_OF_DOUBLE 8
239 #define PR_ALIGN_OF_POINTER 4
241 #elif defined(__alpha__)
242 #define IS_LITTLE_ENDIAN 1
244 #define HAVE_ALIGNED_DOUBLES
245 #define HAVE_ALIGNED_LONGLONGS
248 #define PR_BYTES_PER_BYTE 1
249 #define PR_BYTES_PER_SHORT 2
250 #define PR_BYTES_PER_INT 4
251 #define PR_BYTES_PER_INT64 8
252 #define PR_BYTES_PER_LONG 8
253 #define PR_BYTES_PER_FLOAT 4
254 #define PR_BYTES_PER_DOUBLE 8
255 #define PR_BYTES_PER_WORD 8
256 #define PR_BYTES_PER_DWORD 8
258 #define PR_BITS_PER_BYTE 8
259 #define PR_BITS_PER_SHORT 16
260 #define PR_BITS_PER_INT 32
261 #define PR_BITS_PER_INT64 64
262 #define PR_BITS_PER_LONG 64
263 #define PR_BITS_PER_FLOAT 32
264 #define PR_BITS_PER_DOUBLE 64
265 #define PR_BITS_PER_WORD 64
267 #define PR_BITS_PER_BYTE_LOG2 3
268 #define PR_BITS_PER_SHORT_LOG2 4
269 #define PR_BITS_PER_INT_LOG2 5
270 #define PR_BITS_PER_INT64_LOG2 6
271 #define PR_BITS_PER_LONG_LOG2 6
272 #define PR_BITS_PER_FLOAT_LOG2 5
273 #define PR_BITS_PER_DOUBLE_LOG2 6
274 #define PR_BITS_PER_WORD_LOG2 6
276 #define PR_ALIGN_OF_SHORT 2
277 #define PR_ALIGN_OF_INT 4
278 #define PR_ALIGN_OF_LONG 8
279 #define PR_ALIGN_OF_INT64 8
280 #define PR_ALIGN_OF_FLOAT 4
281 #define PR_ALIGN_OF_DOUBLE 8
282 #define PR_ALIGN_OF_POINTER 8
284 #define PR_BYTES_PER_WORD_LOG2 3
285 #define PR_BYTES_PER_DWORD_LOG2 3
287 #elif defined(__powerpc__) || defined(__m68k__)
289 #undef IS_LITTLE_ENDIAN
290 #define IS_BIG_ENDIAN 1
291 #undef HAVE_ALIGNED_DOUBLES
292 #undef HAVE_ALIGNED_LONGLONGS
294 #define PR_BYTES_PER_BYTE 1
295 #define PR_BYTES_PER_SHORT 2
296 #define PR_BYTES_PER_INT 4
297 #define PR_BYTES_PER_INT64 8
298 #define PR_BYTES_PER_LONG 4
299 #define PR_BYTES_PER_FLOAT 4
300 #define PR_BYTES_PER_DOUBLE 8
301 #define PR_BYTES_PER_WORD 4
302 #define PR_BYTES_PER_DWORD 8
304 #define PR_BITS_PER_BYTE 8
305 #define PR_BITS_PER_SHORT 16
306 #define PR_BITS_PER_INT 32
307 #define PR_BITS_PER_INT64 64
308 #define PR_BITS_PER_LONG 32
309 #define PR_BITS_PER_FLOAT 32
310 #define PR_BITS_PER_DOUBLE 64
311 #define PR_BITS_PER_WORD 32
313 #define PR_BITS_PER_BYTE_LOG2 3
314 #define PR_BITS_PER_SHORT_LOG2 4
315 #define PR_BITS_PER_INT_LOG2 5
316 #define PR_BITS_PER_INT64_LOG2 6
317 #define PR_BITS_PER_LONG_LOG2 5
318 #define PR_BITS_PER_FLOAT_LOG2 5
319 #define PR_BITS_PER_DOUBLE_LOG2 6
320 #define PR_BITS_PER_WORD_LOG2 5
322 #define PR_ALIGN_OF_SHORT 2
323 #define PR_ALIGN_OF_INT 4
324 #define PR_ALIGN_OF_LONG 4
325 #define PR_ALIGN_OF_INT64 4
326 #define PR_ALIGN_OF_FLOAT 4
327 #define PR_ALIGN_OF_DOUBLE 4
328 #define PR_ALIGN_OF_POINTER 4
330 #define PR_BYTES_PER_WORD_LOG2 2
331 #define PR_BYTES_PER_DWORD_LOG2 3
335 #error Must define constants for type sizes here.
340 #ifndef NO_NSPR_10_SUPPORT
342 #define BYTES_PER_BYTE PR_BYTES_PER_BYTE
343 #define BYTES_PER_SHORT PR_BYTES_PER_SHORT
344 #define BYTES_PER_INT PR_BYTES_PER_INT
345 #define BYTES_PER_INT64 PR_BYTES_PER_INT64
346 #define BYTES_PER_LONG PR_BYTES_PER_LONG
347 #define BYTES_PER_FLOAT PR_BYTES_PER_FLOAT
348 #define BYTES_PER_DOUBLE PR_BYTES_PER_DOUBLE
349 #define BYTES_PER_WORD PR_BYTES_PER_WORD
350 #define BYTES_PER_DWORD PR_BYTES_PER_DWORD
352 #define BITS_PER_BYTE PR_BITS_PER_BYTE
353 #define BITS_PER_SHORT PR_BITS_PER_SHORT
354 #define BITS_PER_INT PR_BITS_PER_INT
355 #define BITS_PER_INT64 PR_BITS_PER_INT64
356 #define BITS_PER_LONG PR_BITS_PER_LONG
357 #define BITS_PER_FLOAT PR_BITS_PER_FLOAT
358 #define BITS_PER_DOUBLE PR_BITS_PER_DOUBLE
359 #define BITS_PER_WORD PR_BITS_PER_WORD
361 #define BITS_PER_BYTE_LOG2 PR_BITS_PER_BYTE_LOG2
362 #define BITS_PER_SHORT_LOG2 PR_BITS_PER_SHORT_LOG2
363 #define BITS_PER_INT_LOG2 PR_BITS_PER_INT_LOG2
364 #define BITS_PER_INT64_LOG2 PR_BITS_PER_INT64_LOG2
365 #define BITS_PER_LONG_LOG2 PR_BITS_PER_LONG_LOG2
366 #define BITS_PER_FLOAT_LOG2 PR_BITS_PER_FLOAT_LOG2
367 #define BITS_PER_DOUBLE_LOG2 PR_BITS_PER_DOUBLE_LOG2
368 #define BITS_PER_WORD_LOG2 PR_BITS_PER_WORD_LOG2
370 #define ALIGN_OF_SHORT PR_ALIGN_OF_SHORT
371 #define ALIGN_OF_INT PR_ALIGN_OF_INT
372 #define ALIGN_OF_LONG PR_ALIGN_OF_LONG
373 #define ALIGN_OF_INT64 PR_ALIGN_OF_INT64
374 #define ALIGN_OF_FLOAT PR_ALIGN_OF_FLOAT
375 #define ALIGN_OF_DOUBLE PR_ALIGN_OF_DOUBLE
376 #define ALIGN_OF_POINTER PR_ALIGN_OF_POINTER
377 #define ALIGN_OF_WORD PR_ALIGN_OF_WORD
379 #define BYTES_PER_WORD_LOG2 PR_BYTES_PER_WORD_LOG2
380 #define BYTES_PER_DWORD_LOG2 PR_BYTES_PER_DWORD_LOG2
381 #define WORDS_PER_DWORD_LOG2 PR_WORDS_PER_DWORD_LOG2
383 #endif /* NO_NSPR_10_SUPPORT */
385 #endif /* nspr_cpucfg___ */