1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2/*
3 * The contents of this file are subject to the Mozilla Public
4 * License Version 1.1 (the "License"); you may not use this file
5 * except in compliance with the License. You may obtain a copy of
6 * the License at http://www.mozilla.org/MPL/
7 *
8 * Software distributed under the License is distributed on an "AS
9 * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
10 * implied. See the License for the specific language governing
11 * rights and limitations under the License.
12 *
13 * The Original Code is the Netscape Portable Runtime (NSPR).
14 *
15 * The Initial Developer of the Original Code is Netscape
16 * Communications Corporation.  Portions created by Netscape are
17 * Copyright (C) 1998-2000 Netscape Communications Corporation.  All
18 * Rights Reserved.
19 *
20 * Contributor(s):
21 *
22 * Alternatively, the contents of this file may be used under the
23 * terms of the GNU General Public License Version 2 or later (the
24 * "GPL"), in which case the provisions of the GPL are applicable
25 * instead of those above.  If you wish to allow use of your
26 * version of this file only under the terms of the GPL and not to
27 * allow others to use your version of this file under the MPL,
28 * indicate your decision by deleting the provisions above and
29 * replace them with the notice and other provisions required by
30 * the GPL.  If you do not delete the provisions above, a recipient
31 * may use your version of this file under either the MPL or the
32 * GPL.
33 */
34
35#ifndef nspr_cpucfg___
36#define nspr_cpucfg___
37
38#ifndef XP_UNIX
39#define XP_UNIX
40#endif
41
42#ifndef OPENBSD
43#define OPENBSD
44#endif
45
46#define PR_AF_INET6 24  /* same as AF_INET6 */
47
48#if defined(__i386__)
49
50#define IS_LITTLE_ENDIAN 1
51#undef  IS_BIG_ENDIAN
52#define	HAVE_LONG_LONG
53#undef	HAVE_ALIGNED_DOUBLES
54#undef	HAVE_ALIGNED_LONGLONGS
55
56#define PR_BYTES_PER_BYTE   1
57#define PR_BYTES_PER_SHORT  2
58#define PR_BYTES_PER_INT    4
59#define PR_BYTES_PER_INT64  8
60#define PR_BYTES_PER_LONG   4
61#define PR_BYTES_PER_FLOAT  4
62#define PR_BYTES_PER_DOUBLE 8
63#define PR_BYTES_PER_WORD   4
64#define PR_BYTES_PER_DWORD  8
65#define PR_BYTES_PER_WORD_LOG2   2
66#define PR_BYTES_PER_DWORD_LOG2  3
67
68#define PR_BITS_PER_BYTE    8
69#define PR_BITS_PER_SHORT   16
70#define PR_BITS_PER_INT     32
71#define PR_BITS_PER_INT64   64
72#define PR_BITS_PER_LONG    32
73#define PR_BITS_PER_FLOAT   32
74#define PR_BITS_PER_DOUBLE  64
75#define PR_BITS_PER_WORD    32
76
77#define PR_BITS_PER_BYTE_LOG2   3
78#define PR_BITS_PER_SHORT_LOG2  4
79#define PR_BITS_PER_INT_LOG2    5
80#define PR_BITS_PER_INT64_LOG2  6
81#define PR_BITS_PER_LONG_LOG2   5
82#define PR_BITS_PER_FLOAT_LOG2  5
83#define PR_BITS_PER_DOUBLE_LOG2 6
84#define PR_BITS_PER_WORD_LOG2   5
85
86#define PR_ALIGN_OF_SHORT   2
87#define PR_ALIGN_OF_INT     4
88#define PR_ALIGN_OF_LONG    4
89#define PR_ALIGN_OF_INT64   4
90#define PR_ALIGN_OF_FLOAT   4
91#define PR_ALIGN_OF_DOUBLE  4
92#define PR_ALIGN_OF_POINTER 4
93
94#elif defined(__amd64__)
95
96#define IS_LITTLE_ENDIAN 1
97#undef  IS_BIG_ENDIAN
98#define IS_64
99
100#define PR_BYTES_PER_BYTE   1
101#define PR_BYTES_PER_SHORT  2
102#define PR_BYTES_PER_INT    4
103#define PR_BYTES_PER_INT64  8
104#define PR_BYTES_PER_LONG   8
105#define PR_BYTES_PER_FLOAT  4
106#define PR_BYTES_PER_DOUBLE 8
107#define PR_BYTES_PER_WORD   8
108#define PR_BYTES_PER_DWORD  8
109
110#define PR_BITS_PER_BYTE    8
111#define PR_BITS_PER_SHORT   16
112#define PR_BITS_PER_INT     32
113#define PR_BITS_PER_INT64   64
114#define PR_BITS_PER_LONG    64
115#define PR_BITS_PER_FLOAT   32
116#define PR_BITS_PER_DOUBLE  64
117#define PR_BITS_PER_WORD    64
118
119#define PR_BITS_PER_BYTE_LOG2   3
120#define PR_BITS_PER_SHORT_LOG2  4
121#define PR_BITS_PER_INT_LOG2    5
122#define PR_BITS_PER_INT64_LOG2  6
123#define PR_BITS_PER_LONG_LOG2   6
124#define PR_BITS_PER_FLOAT_LOG2  5
125#define PR_BITS_PER_DOUBLE_LOG2 6
126#define PR_BITS_PER_WORD_LOG2   6
127
128#define PR_ALIGN_OF_SHORT   2
129#define PR_ALIGN_OF_INT     4
130#define PR_ALIGN_OF_LONG    8
131#define PR_ALIGN_OF_INT64   8
132#define PR_ALIGN_OF_FLOAT   4
133#define PR_ALIGN_OF_DOUBLE  8
134#define PR_ALIGN_OF_POINTER 8
135#define PR_ALIGN_OF_WORD    8
136
137#define PR_BYTES_PER_WORD_LOG2  3
138#define PR_BYTES_PER_DWORD_LOG2 3
139
140#define HAVE_LONG_LONG
141#define HAVE_ALIGNED_DOUBLES
142#define HAVE_ALIGNED_LONGLONGS
143
144#elif defined(__sparc_v9__)
145
146#undef  IS_LITTLE_ENDIAN
147#define IS_BIG_ENDIAN 1
148#define HAVE_LONG_LONG
149#define HAVE_ALIGNED_DOUBLES
150#define HAVE_ALIGNED_LONGLONGS
151#define IS_64
152
153#define PR_BYTES_PER_BYTE   1
154#define PR_BYTES_PER_SHORT  2
155#define PR_BYTES_PER_INT    4
156#define PR_BYTES_PER_INT64  8
157#define PR_BYTES_PER_LONG   8
158#define PR_BYTES_PER_FLOAT  4
159#define PR_BYTES_PER_DOUBLE 8
160#define PR_BYTES_PER_WORD   8
161#define PR_BYTES_PER_DWORD  8
162
163#define PR_BITS_PER_BYTE    8
164#define PR_BITS_PER_SHORT   16
165#define PR_BITS_PER_INT     32
166#define PR_BITS_PER_INT64   64
167#define PR_BITS_PER_LONG    64
168#define PR_BITS_PER_FLOAT   32
169#define PR_BITS_PER_DOUBLE  64
170#define PR_BITS_PER_WORD    64
171
172#define PR_BITS_PER_BYTE_LOG2   3
173#define PR_BITS_PER_SHORT_LOG2  4
174#define PR_BITS_PER_INT_LOG2    5
175#define PR_BITS_PER_INT64_LOG2  6
176#define PR_BITS_PER_LONG_LOG2   6
177#define PR_BITS_PER_FLOAT_LOG2  5
178#define PR_BITS_PER_DOUBLE_LOG2 6
179#define PR_BITS_PER_WORD_LOG2   6
180
181#define PR_ALIGN_OF_SHORT   2
182#define PR_ALIGN_OF_INT     4
183#define PR_ALIGN_OF_LONG    8
184#define PR_ALIGN_OF_INT64   8
185#define PR_ALIGN_OF_FLOAT   4
186#define PR_ALIGN_OF_DOUBLE  8
187#define PR_ALIGN_OF_POINTER 8
188
189#define PR_BYTES_PER_WORD_LOG2  3
190#define PR_BYTES_PER_DWORD_LOG2 3
191
192#elif defined(__sparc__)
193
194#undef IS_LITTLE_ENDIAN
195#define  IS_BIG_ENDIAN 1
196#define HAVE_LONG_LONG
197#define  HAVE_ALIGNED_DOUBLES
198#define  HAVE_ALIGNED_LONGLONGS
199
200#define PR_BYTES_PER_BYTE   1
201#define PR_BYTES_PER_SHORT  2
202#define PR_BYTES_PER_INT    4
203#define PR_BYTES_PER_INT64  8
204#define PR_BYTES_PER_LONG   4
205#define PR_BYTES_PER_FLOAT  4
206#define PR_BYTES_PER_DOUBLE 8
207#define PR_BYTES_PER_WORD   4
208#define PR_BYTES_PER_DWORD  8
209#define PR_BYTES_PER_WORD_LOG2   2
210#define PR_BYTES_PER_DWORD_LOG2  3
211
212#define PR_BITS_PER_BYTE    8
213#define PR_BITS_PER_SHORT   16
214#define PR_BITS_PER_INT     32
215#define PR_BITS_PER_INT64   64
216#define PR_BITS_PER_LONG    32
217#define PR_BITS_PER_FLOAT   32
218#define PR_BITS_PER_DOUBLE  64
219#define PR_BITS_PER_WORD    32
220
221#define PR_BITS_PER_BYTE_LOG2   3
222#define PR_BITS_PER_SHORT_LOG2  4
223#define PR_BITS_PER_INT_LOG2    5
224#define PR_BITS_PER_INT64_LOG2  6
225#define PR_BITS_PER_LONG_LOG2   5
226#define PR_BITS_PER_FLOAT_LOG2  5
227#define PR_BITS_PER_DOUBLE_LOG2 6
228#define PR_BITS_PER_WORD_LOG2   5
229
230#define PR_ALIGN_OF_SHORT   2
231#define PR_ALIGN_OF_INT     4
232#define PR_ALIGN_OF_LONG    4
233#define PR_ALIGN_OF_INT64   8
234#define PR_ALIGN_OF_FLOAT   4
235#define PR_ALIGN_OF_DOUBLE  8
236#define PR_ALIGN_OF_POINTER 4
237
238#elif defined(__alpha__)
239#define IS_LITTLE_ENDIAN 1
240#undef  IS_BIG_ENDIAN
241#define	HAVE_LONG_LONG
242#define	HAVE_ALIGNED_DOUBLES
243#define	HAVE_ALIGNED_LONGLONGS
244#define IS_64
245
246#define PR_BYTES_PER_BYTE   1
247#define PR_BYTES_PER_SHORT  2
248#define PR_BYTES_PER_INT    4
249#define PR_BYTES_PER_INT64  8
250#define PR_BYTES_PER_LONG   8
251#define PR_BYTES_PER_FLOAT  4
252#define PR_BYTES_PER_DOUBLE 8
253#define PR_BYTES_PER_WORD   8
254#define PR_BYTES_PER_DWORD  8
255
256#define PR_BITS_PER_BYTE    8
257#define PR_BITS_PER_SHORT   16
258#define PR_BITS_PER_INT     32
259#define PR_BITS_PER_INT64   64
260#define PR_BITS_PER_LONG    64
261#define PR_BITS_PER_FLOAT   32
262#define PR_BITS_PER_DOUBLE  64
263#define PR_BITS_PER_WORD    64
264
265#define PR_BITS_PER_BYTE_LOG2   3
266#define PR_BITS_PER_SHORT_LOG2  4
267#define PR_BITS_PER_INT_LOG2    5
268#define PR_BITS_PER_INT64_LOG2  6
269#define PR_BITS_PER_LONG_LOG2   6
270#define PR_BITS_PER_FLOAT_LOG2  5
271#define PR_BITS_PER_DOUBLE_LOG2 6
272#define PR_BITS_PER_WORD_LOG2   6
273
274#define PR_ALIGN_OF_SHORT   2
275#define PR_ALIGN_OF_INT     4
276#define PR_ALIGN_OF_LONG    8
277#define PR_ALIGN_OF_INT64   8
278#define PR_ALIGN_OF_FLOAT   4
279#define PR_ALIGN_OF_DOUBLE  8
280#define PR_ALIGN_OF_POINTER 8
281
282#define PR_BYTES_PER_WORD_LOG2  3
283#define PR_BYTES_PER_DWORD_LOG2 3
284
285#elif defined(__powerpc__) || defined(__m68k__)
286
287#undef  IS_LITTLE_ENDIAN
288#define IS_BIG_ENDIAN    1
289#define	HAVE_LONG_LONG
290#undef	HAVE_ALIGNED_DOUBLES
291#undef	HAVE_ALIGNED_LONGLONGS
292
293#define PR_BYTES_PER_BYTE   1
294#define PR_BYTES_PER_SHORT  2
295#define PR_BYTES_PER_INT    4
296#define PR_BYTES_PER_INT64  8
297#define PR_BYTES_PER_LONG   4
298#define PR_BYTES_PER_FLOAT  4
299#define PR_BYTES_PER_DOUBLE 8
300#define PR_BYTES_PER_WORD   4
301#define PR_BYTES_PER_DWORD  8
302
303#define PR_BITS_PER_BYTE    8
304#define PR_BITS_PER_SHORT   16
305#define PR_BITS_PER_INT     32
306#define PR_BITS_PER_INT64   64
307#define PR_BITS_PER_LONG    32
308#define PR_BITS_PER_FLOAT   32
309#define PR_BITS_PER_DOUBLE  64
310#define PR_BITS_PER_WORD    32
311
312#define PR_BITS_PER_BYTE_LOG2   3
313#define PR_BITS_PER_SHORT_LOG2  4
314#define PR_BITS_PER_INT_LOG2    5
315#define PR_BITS_PER_INT64_LOG2  6
316#define PR_BITS_PER_LONG_LOG2   5
317#define PR_BITS_PER_FLOAT_LOG2  5
318#define PR_BITS_PER_DOUBLE_LOG2 6
319#define PR_BITS_PER_WORD_LOG2   5
320
321#define PR_ALIGN_OF_SHORT   2
322#define PR_ALIGN_OF_INT     4
323#define PR_ALIGN_OF_LONG    4
324#define PR_ALIGN_OF_INT64   4
325#define PR_ALIGN_OF_FLOAT   4
326#define PR_ALIGN_OF_DOUBLE  4
327#define PR_ALIGN_OF_POINTER 4
328
329#define PR_BYTES_PER_WORD_LOG2   2
330#define PR_BYTES_PER_DWORD_LOG2  3
331
332#else
333
334#error Must define constants for type sizes here.
335
336#endif
337
338
339#ifndef NO_NSPR_10_SUPPORT
340
341#define BYTES_PER_BYTE		PR_BYTES_PER_BYTE
342#define BYTES_PER_SHORT 	PR_BYTES_PER_SHORT
343#define BYTES_PER_INT 		PR_BYTES_PER_INT
344#define BYTES_PER_INT64		PR_BYTES_PER_INT64
345#define BYTES_PER_LONG		PR_BYTES_PER_LONG
346#define BYTES_PER_FLOAT		PR_BYTES_PER_FLOAT
347#define BYTES_PER_DOUBLE	PR_BYTES_PER_DOUBLE
348#define BYTES_PER_WORD		PR_BYTES_PER_WORD
349#define BYTES_PER_DWORD		PR_BYTES_PER_DWORD
350
351#define BITS_PER_BYTE		PR_BITS_PER_BYTE
352#define BITS_PER_SHORT		PR_BITS_PER_SHORT
353#define BITS_PER_INT		PR_BITS_PER_INT
354#define BITS_PER_INT64		PR_BITS_PER_INT64
355#define BITS_PER_LONG		PR_BITS_PER_LONG
356#define BITS_PER_FLOAT		PR_BITS_PER_FLOAT
357#define BITS_PER_DOUBLE		PR_BITS_PER_DOUBLE
358#define BITS_PER_WORD		PR_BITS_PER_WORD
359
360#define BITS_PER_BYTE_LOG2	PR_BITS_PER_BYTE_LOG2
361#define BITS_PER_SHORT_LOG2	PR_BITS_PER_SHORT_LOG2
362#define BITS_PER_INT_LOG2	PR_BITS_PER_INT_LOG2
363#define BITS_PER_INT64_LOG2	PR_BITS_PER_INT64_LOG2
364#define BITS_PER_LONG_LOG2	PR_BITS_PER_LONG_LOG2
365#define BITS_PER_FLOAT_LOG2	PR_BITS_PER_FLOAT_LOG2
366#define BITS_PER_DOUBLE_LOG2 	PR_BITS_PER_DOUBLE_LOG2
367#define BITS_PER_WORD_LOG2	PR_BITS_PER_WORD_LOG2
368
369#define ALIGN_OF_SHORT		PR_ALIGN_OF_SHORT
370#define ALIGN_OF_INT		PR_ALIGN_OF_INT
371#define ALIGN_OF_LONG		PR_ALIGN_OF_LONG
372#define ALIGN_OF_INT64		PR_ALIGN_OF_INT64
373#define ALIGN_OF_FLOAT		PR_ALIGN_OF_FLOAT
374#define ALIGN_OF_DOUBLE		PR_ALIGN_OF_DOUBLE
375#define ALIGN_OF_POINTER	PR_ALIGN_OF_POINTER
376#define ALIGN_OF_WORD		PR_ALIGN_OF_WORD
377
378#define BYTES_PER_WORD_LOG2	PR_BYTES_PER_WORD_LOG2
379#define BYTES_PER_DWORD_LOG2	PR_BYTES_PER_DWORD_LOG2
380#define WORDS_PER_DWORD_LOG2	PR_WORDS_PER_DWORD_LOG2
381
382#endif /* NO_NSPR_10_SUPPORT */
383
384#endif /* nspr_cpucfg___ */
385