• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 the Netscape Portable Runtime (NSPR).
16  *
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.
21  *
22  * Contributor(s):
23  *
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.
35  *
36  * ***** END LICENSE BLOCK ***** */
37 
38 #ifndef nspr_cpucfg___
39 #define nspr_cpucfg___
40 
41 #ifndef XP_UNIX
42 #define XP_UNIX
43 #endif
44 
45 #ifndef OPENBSD
46 #define OPENBSD
47 #endif
48 
49 #define PR_AF_INET6 28  /* same as AF_INET6 */
50 
51 #ifndef HAVE_LONG_LONG
52 #define HAVE_LONG_LONG
53 #endif
54 
55 #if defined(__i386__)
56 
57 #define IS_LITTLE_ENDIAN 1
58 #undef  IS_BIG_ENDIAN
59 #undef	HAVE_ALIGNED_DOUBLES
60 #undef	HAVE_ALIGNED_LONGLONGS
61 
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
73 
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
82 
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
91 
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
99 
100 #elif defined(__alpha__)
101 
102 #define IS_LITTLE_ENDIAN 1
103 #undef  IS_BIG_ENDIAN
104 #define	HAVE_ALIGNED_DOUBLES
105 #define	HAVE_ALIGNED_LONGLONGS
106 #define IS_64
107 
108 #define PR_BYTES_PER_BYTE   1
109 #define PR_BYTES_PER_SHORT  2
110 #define PR_BYTES_PER_INT    4
111 #define PR_BYTES_PER_INT64  8
112 #define PR_BYTES_PER_LONG   8
113 #define PR_BYTES_PER_FLOAT  4
114 #define PR_BYTES_PER_DOUBLE 8
115 #define PR_BYTES_PER_WORD   8
116 #define PR_BYTES_PER_DWORD  8
117 #define PR_BYTES_PER_WORD_LOG2   3
118 #define PR_BYTES_PER_DWORD_LOG2  3
119 
120 #define PR_BITS_PER_BYTE    8
121 #define PR_BITS_PER_SHORT   16
122 #define PR_BITS_PER_INT     32
123 #define PR_BITS_PER_INT64   64
124 #define PR_BITS_PER_LONG    64
125 #define PR_BITS_PER_FLOAT   32
126 #define PR_BITS_PER_DOUBLE  64
127 #define PR_BITS_PER_WORD    64
128 
129 #define PR_BITS_PER_BYTE_LOG2   3
130 #define PR_BITS_PER_SHORT_LOG2  4
131 #define PR_BITS_PER_INT_LOG2    5
132 #define PR_BITS_PER_INT64_LOG2  6
133 #define PR_BITS_PER_LONG_LOG2   6
134 #define PR_BITS_PER_FLOAT_LOG2  5
135 #define PR_BITS_PER_DOUBLE_LOG2 6
136 #define PR_BITS_PER_WORD_LOG2   6
137 
138 #define PR_ALIGN_OF_SHORT   2
139 #define PR_ALIGN_OF_INT     4
140 #define PR_ALIGN_OF_LONG    8
141 #define PR_ALIGN_OF_INT64   8
142 #define PR_ALIGN_OF_FLOAT   4
143 #define PR_ALIGN_OF_DOUBLE  8
144 #define PR_ALIGN_OF_POINTER 8
145 
146 #elif defined(__sparc__)
147 
148 #undef  IS_LITTLE_ENDIAN
149 #define IS_BIG_ENDIAN 1
150 #define	HAVE_ALIGNED_DOUBLES
151 #define	HAVE_ALIGNED_LONGLONGS
152 #define IS_64
153 
154 #define PR_BYTES_PER_BYTE   1
155 #define PR_BYTES_PER_SHORT  2
156 #define PR_BYTES_PER_INT    4
157 #define PR_BYTES_PER_INT64  8
158 #define PR_BYTES_PER_LONG   8
159 #define PR_BYTES_PER_FLOAT  4
160 #define PR_BYTES_PER_DOUBLE 8
161 #define PR_BYTES_PER_WORD   8
162 #define PR_BYTES_PER_DWORD  8
163 #define PR_BYTES_PER_WORD_LOG2   3
164 #define PR_BYTES_PER_DWORD_LOG2  3
165 
166 #define PR_BITS_PER_BYTE    8
167 #define PR_BITS_PER_SHORT   16
168 #define PR_BITS_PER_INT     32
169 #define PR_BITS_PER_INT64   64
170 #define PR_BITS_PER_LONG    64
171 #define PR_BITS_PER_FLOAT   32
172 #define PR_BITS_PER_DOUBLE  64
173 #define PR_BITS_PER_WORD    64
174 
175 #define PR_BITS_PER_BYTE_LOG2   3
176 #define PR_BITS_PER_SHORT_LOG2  4
177 #define PR_BITS_PER_INT_LOG2    5
178 #define PR_BITS_PER_INT64_LOG2  6
179 #define PR_BITS_PER_LONG_LOG2   6
180 #define PR_BITS_PER_FLOAT_LOG2  5
181 #define PR_BITS_PER_DOUBLE_LOG2 6
182 #define PR_BITS_PER_WORD_LOG2   6
183 
184 #define PR_ALIGN_OF_SHORT   2
185 #define PR_ALIGN_OF_INT     4
186 #define PR_ALIGN_OF_LONG    8
187 #define PR_ALIGN_OF_INT64   8
188 #define PR_ALIGN_OF_FLOAT   4
189 #define PR_ALIGN_OF_DOUBLE  8
190 #define PR_ALIGN_OF_POINTER 8
191 
192 #elif defined(__ia64__)
193 
194 #define IS_LITTLE_ENDIAN 1
195 #undef  IS_BIG_ENDIAN
196 #define	HAVE_ALIGNED_DOUBLES
197 #define	HAVE_ALIGNED_LONGLONGS
198 #define IS_64
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   8
205 #define PR_BYTES_PER_FLOAT  4
206 #define PR_BYTES_PER_DOUBLE 8
207 #define PR_BYTES_PER_WORD   8
208 #define PR_BYTES_PER_DWORD  8
209 #define PR_BYTES_PER_WORD_LOG2   3
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    64
217 #define PR_BITS_PER_FLOAT   32
218 #define PR_BITS_PER_DOUBLE  64
219 #define PR_BITS_PER_WORD    64
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   6
226 #define PR_BITS_PER_FLOAT_LOG2  5
227 #define PR_BITS_PER_DOUBLE_LOG2 6
228 #define PR_BITS_PER_WORD_LOG2   6
229 
230 #define PR_ALIGN_OF_SHORT   2
231 #define PR_ALIGN_OF_INT     4
232 #define PR_ALIGN_OF_LONG    8
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 8
237 #define PR_ALIGN_OF_WORD    8
238 
239 #elif defined(__amd64__)
240 
241 #define IS_LITTLE_ENDIAN 1
242 #undef  IS_BIG_ENDIAN
243 #define	HAVE_ALIGNED_DOUBLES
244 #define	HAVE_ALIGNED_LONGLONGS
245 #define IS_64
246 
247 #define PR_BYTES_PER_BYTE   1
248 #define PR_BYTES_PER_SHORT  2
249 #define PR_BYTES_PER_INT    4
250 #define PR_BYTES_PER_INT64  8
251 #define PR_BYTES_PER_LONG   8
252 #define PR_BYTES_PER_FLOAT  4
253 #define PR_BYTES_PER_DOUBLE 8
254 #define PR_BYTES_PER_WORD   8
255 #define PR_BYTES_PER_DWORD  8
256 #define PR_BYTES_PER_WORD_LOG2   3
257 #define PR_BYTES_PER_DWORD_LOG2  3
258 
259 #define PR_BITS_PER_BYTE    8
260 #define PR_BITS_PER_SHORT   16
261 #define PR_BITS_PER_INT     32
262 #define PR_BITS_PER_INT64   64
263 #define PR_BITS_PER_LONG    64
264 #define PR_BITS_PER_FLOAT   32
265 #define PR_BITS_PER_DOUBLE  64
266 #define PR_BITS_PER_WORD    64
267 
268 #define PR_BITS_PER_BYTE_LOG2   3
269 #define PR_BITS_PER_SHORT_LOG2  4
270 #define PR_BITS_PER_INT_LOG2    5
271 #define PR_BITS_PER_INT64_LOG2  6
272 #define PR_BITS_PER_LONG_LOG2   6
273 #define PR_BITS_PER_FLOAT_LOG2  5
274 #define PR_BITS_PER_DOUBLE_LOG2 6
275 #define PR_BITS_PER_WORD_LOG2   6
276 
277 #define PR_ALIGN_OF_SHORT   2
278 #define PR_ALIGN_OF_INT     4
279 #define PR_ALIGN_OF_LONG    8
280 #define PR_ALIGN_OF_INT64   8
281 #define PR_ALIGN_OF_FLOAT   4
282 #define PR_ALIGN_OF_DOUBLE  8
283 #define PR_ALIGN_OF_POINTER 8
284 #define PR_ALIGN_OF_WORD    8
285 
286 #else
287 
288 #error "Unknown CPU architecture"
289 
290 #endif
291 
292 #ifndef NO_NSPR_10_SUPPORT
293 
294 #define BYTES_PER_BYTE		PR_BYTES_PER_BYTE
295 #define BYTES_PER_SHORT 	PR_BYTES_PER_SHORT
296 #define BYTES_PER_INT 		PR_BYTES_PER_INT
297 #define BYTES_PER_INT64		PR_BYTES_PER_INT64
298 #define BYTES_PER_LONG		PR_BYTES_PER_LONG
299 #define BYTES_PER_FLOAT		PR_BYTES_PER_FLOAT
300 #define BYTES_PER_DOUBLE	PR_BYTES_PER_DOUBLE
301 #define BYTES_PER_WORD		PR_BYTES_PER_WORD
302 #define BYTES_PER_DWORD		PR_BYTES_PER_DWORD
303 
304 #define BITS_PER_BYTE		PR_BITS_PER_BYTE
305 #define BITS_PER_SHORT		PR_BITS_PER_SHORT
306 #define BITS_PER_INT		PR_BITS_PER_INT
307 #define BITS_PER_INT64		PR_BITS_PER_INT64
308 #define BITS_PER_LONG		PR_BITS_PER_LONG
309 #define BITS_PER_FLOAT		PR_BITS_PER_FLOAT
310 #define BITS_PER_DOUBLE		PR_BITS_PER_DOUBLE
311 #define BITS_PER_WORD		PR_BITS_PER_WORD
312 
313 #define BITS_PER_BYTE_LOG2	PR_BITS_PER_BYTE_LOG2
314 #define BITS_PER_SHORT_LOG2	PR_BITS_PER_SHORT_LOG2
315 #define BITS_PER_INT_LOG2	PR_BITS_PER_INT_LOG2
316 #define BITS_PER_INT64_LOG2	PR_BITS_PER_INT64_LOG2
317 #define BITS_PER_LONG_LOG2	PR_BITS_PER_LONG_LOG2
318 #define BITS_PER_FLOAT_LOG2	PR_BITS_PER_FLOAT_LOG2
319 #define BITS_PER_DOUBLE_LOG2 	PR_BITS_PER_DOUBLE_LOG2
320 #define BITS_PER_WORD_LOG2	PR_BITS_PER_WORD_LOG2
321 
322 #define ALIGN_OF_SHORT		PR_ALIGN_OF_SHORT
323 #define ALIGN_OF_INT		PR_ALIGN_OF_INT
324 #define ALIGN_OF_LONG		PR_ALIGN_OF_LONG
325 #define ALIGN_OF_INT64		PR_ALIGN_OF_INT64
326 #define ALIGN_OF_FLOAT		PR_ALIGN_OF_FLOAT
327 #define ALIGN_OF_DOUBLE		PR_ALIGN_OF_DOUBLE
328 #define ALIGN_OF_POINTER	PR_ALIGN_OF_POINTER
329 #define ALIGN_OF_WORD		PR_ALIGN_OF_WORD
330 
331 #define BYTES_PER_WORD_LOG2	PR_BYTES_PER_WORD_LOG2
332 #define BYTES_PER_DWORD_LOG2	PR_BYTES_PER_DWORD_LOG2
333 #define WORDS_PER_DWORD_LOG2	PR_WORDS_PER_DWORD_LOG2
334 
335 #endif /* NO_NSPR_10_SUPPORT */
336 
337 #endif /* nspr_cpucfg___ */
338