Cygwin: access: Fix X_OK behaviour for backup operators and admins
[newlib-cygwin.git] / newlib / libc / include / machine / ieeefp.h
blobf99577bea1476f9a2a0abb3c6261559ed6c9d3fe
1 #ifndef __IEEE_BIG_ENDIAN
2 #ifndef __IEEE_LITTLE_ENDIAN
4 /* This file can define macros to choose variations of the IEEE float
5 format:
7 _FLT_LARGEST_EXPONENT_IS_NORMAL
9 Defined if the float format uses the largest exponent for finite
10 numbers rather than NaN and infinity representations. Such a
11 format cannot represent NaNs or infinities at all, but it's FLT_MAX
12 is twice the IEEE value.
14 _FLT_NO_DENORMALS
16 Defined if the float format does not support IEEE denormals. Every
17 float with a zero exponent is taken to be a zero representation.
19 ??? At the moment, there are no equivalent macros above for doubles and
20 the macros are not fully supported by --enable-newlib-hw-fp.
22 __IEEE_BIG_ENDIAN
24 Defined if the float format is big endian. This is mutually exclusive
25 with __IEEE_LITTLE_ENDIAN.
27 __IEEE_LITTLE_ENDIAN
29 Defined if the float format is little endian. This is mutually exclusive
30 with __IEEE_BIG_ENDIAN.
32 Note that one of __IEEE_BIG_ENDIAN or __IEEE_LITTLE_ENDIAN must be specified for a
33 platform or error will occur.
35 __IEEE_BYTES_LITTLE_ENDIAN
37 This flag is used in conjunction with __IEEE_BIG_ENDIAN to describe a situation
38 whereby multiple words of an IEEE floating point are in big endian order, but the
39 words themselves are little endian with respect to the bytes.
41 _DOUBLE_IS_32BITS
43 This is used on platforms that support double by using the 32-bit IEEE
44 float type.
46 _FLOAT_ARG
48 This represents what type a float arg is passed as. It is used when the type is
49 not promoted to double.
52 __OBSOLETE_MATH_DEFAULT
54 Default value for __OBSOLETE_MATH if that's not set by the user.
55 It should be set here based on predefined feature macros.
57 __OBSOLETE_MATH
59 If set to 1 then some new math code will be disabled and older libm
60 code will be used instead. This is necessary because the new math
61 code does not support all targets, it assumes that the toolchain has
62 ISO C99 support (hexfloat literals, standard fenv semantics), the
63 target has IEEE-754 conforming binary32 float and binary64 double
64 (not mixed endian) representation, standard SNaN representation,
65 double and single precision arithmetics has similar latency and it
66 has no legacy SVID matherr support, only POSIX errno and fenv
67 exception based error handling.
70 #if (defined(__arm__) || defined(__thumb__)) && !defined(__MAVERICK__)
71 /* ARM traditionally used big-endian words; and within those words the
72 byte ordering was big or little endian depending upon the target.
73 Modern floating-point formats are naturally ordered; in this case
74 __VFP_FP__ will be defined, even if soft-float. */
75 #ifdef __VFP_FP__
76 # ifdef __ARMEL__
77 # define __IEEE_LITTLE_ENDIAN
78 # else
79 # define __IEEE_BIG_ENDIAN
80 # endif
81 # if __ARM_FP & 0x8
82 # define __OBSOLETE_MATH_DEFAULT 0
83 # endif
84 #else
85 # define __IEEE_BIG_ENDIAN
86 # ifdef __ARMEL__
87 # define __IEEE_BYTES_LITTLE_ENDIAN
88 # endif
89 #endif
90 #ifndef __SOFTFP__
91 # define _SUPPORTS_ERREXCEPT
92 #endif
93 /* As per ISO/IEC TS 18661 '__FLT_EVAL_METHOD__' will be defined to 16
94 (if compiling with +fp16 support) so it can't be used by math.h to
95 define float_t and double_t. For values of '__FLT_EVAL_METHOD__'
96 other than 0, 1, 2 the definition of float_t and double_t is
97 implementation-defined. */
98 #define __DOUBLE_TYPE double
99 #define __FLOAT_TYPE float
100 #endif
102 #if defined (__aarch64__)
103 #if defined (__AARCH64EL__)
104 #define __IEEE_LITTLE_ENDIAN
105 #else
106 #define __IEEE_BIG_ENDIAN
107 #endif
108 #define __OBSOLETE_MATH_DEFAULT 0
109 #ifdef __ARM_FP
110 # define _SUPPORTS_ERREXCEPT
111 #endif
112 /* As per ISO/IEC TS 18661 '__FLT_EVAL_METHOD__' will be defined to 16
113 (if compiling with +fp16 support) so it can't be used by math.h to
114 define float_t and double_t. For values of '__FLT_EVAL_METHOD__'
115 other than 0, 1, 2 the definition of float_t and double_t is
116 implementation-defined. */
117 #define __DOUBLE_TYPE double
118 #define __FLOAT_TYPE float
119 #endif
121 #ifdef __epiphany__
122 #define __IEEE_LITTLE_ENDIAN
123 #define Sudden_Underflow 1
124 #endif
126 #ifdef __hppa__
127 #define __IEEE_BIG_ENDIAN
128 #endif
130 #ifdef __nds32__
131 #ifdef __big_endian__
132 #define __IEEE_BIG_ENDIAN
133 #else
134 #define __IEEE_LITTLE_ENDIAN
135 #endif
136 #endif
138 #ifdef __SPU__
139 #define __IEEE_BIG_ENDIAN
141 #define isfinite(__y) \
142 (__extension__ ({int __cy; \
143 (sizeof (__y) == sizeof (float)) ? (1) : \
144 (__cy = fpclassify(__y)) != FP_INFINITE && __cy != FP_NAN;}))
146 #define isinf(__x) ((sizeof (__x) == sizeof (float)) ? (0) : __isinfd(__x))
147 #define isnan(__x) ((sizeof (__x) == sizeof (float)) ? (0) : __isnand(__x))
150 * Macros for use in ieeefp.h. We can't just define the real ones here
151 * (like those above) as we have name space issues when this is *not*
152 * included via generic the ieeefp.h.
154 #define __ieeefp_isnanf(x) 0
155 #define __ieeefp_isinff(x) 0
156 #define __ieeefp_finitef(x) 1
157 #endif
159 #ifdef __sparc__
160 #ifdef __LITTLE_ENDIAN_DATA__
161 #define __IEEE_LITTLE_ENDIAN
162 #else
163 #define __IEEE_BIG_ENDIAN
164 #endif
165 #endif
167 #if defined(__m68k__) || defined(__mc68000__)
168 #define __IEEE_BIG_ENDIAN
169 #endif
171 #if defined(__mc68hc11__) || defined(__mc68hc12__) || defined(__mc68hc1x__)
172 #define __IEEE_BIG_ENDIAN
173 #ifdef __HAVE_SHORT_DOUBLE__
174 # define _DOUBLE_IS_32BITS
175 #endif
176 #endif
178 #if defined (__H8300__) || defined (__H8300H__) || defined (__H8300S__) || defined (__H8500__) || defined (__H8300SX__)
179 #define __IEEE_BIG_ENDIAN
180 #define _FLOAT_ARG float
181 #define _DOUBLE_IS_32BITS
182 #endif
184 #if defined (__xc16x__) || defined (__xc16xL__) || defined (__xc16xS__)
185 #define __IEEE_LITTLE_ENDIAN
186 #define _FLOAT_ARG float
187 #define _DOUBLE_IS_32BITS
188 #endif
191 #ifdef __sh__
192 #ifdef __LITTLE_ENDIAN__
193 #define __IEEE_LITTLE_ENDIAN
194 #else
195 #define __IEEE_BIG_ENDIAN
196 #endif
197 #if defined(__SH2E__) || defined(__SH3E__) || defined(__SH4_SINGLE_ONLY__) || defined(__SH2A_SINGLE_ONLY__)
198 #define _DOUBLE_IS_32BITS
199 #endif
200 #endif
202 #ifdef _AM29K
203 #define __IEEE_BIG_ENDIAN
204 #endif
206 #ifdef _WIN32
207 #define __IEEE_LITTLE_ENDIAN
208 #endif
210 #ifdef __i386__
211 #define __IEEE_LITTLE_ENDIAN
212 # define _SUPPORTS_ERREXCEPT
213 #endif
215 #ifdef __riscv
216 #if defined(__BYTE_ORDER__) && (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)
217 #define __IEEE_BIG_ENDIAN
218 #else
219 #define __IEEE_LITTLE_ENDIAN
220 #endif
221 #if defined(__riscv_flen) || defined (__riscv_zfinx)
222 # define _SUPPORTS_ERREXCEPT
223 #endif
224 #if (__riscv_flen == 64) || defined (__riscv_zdinx)
225 # define __OBSOLETE_MATH_DEFAULT 0
226 #else
227 # define __OBSOLETE_MATH_DEFAULT 1
228 #endif
229 #endif
231 #ifdef __i960__
232 #define __IEEE_LITTLE_ENDIAN
233 #endif
235 #ifdef __lm32__
236 #define __IEEE_BIG_ENDIAN
237 #endif
239 #ifdef __M32R__
240 #define __IEEE_BIG_ENDIAN
241 #endif
243 #ifdef __nvptx__
244 #define __IEEE_LITTLE_ENDIAN
245 #endif
247 #if defined(_C4x) || defined(_C3x)
248 #define __IEEE_BIG_ENDIAN
249 #define _DOUBLE_IS_32BITS
250 #endif
252 #ifdef __TMS320C6X__
253 #ifdef _BIG_ENDIAN
254 #define __IEEE_BIG_ENDIAN
255 #else
256 #define __IEEE_LITTLE_ENDIAN
257 #endif
258 #endif
260 #ifdef __TIC80__
261 #define __IEEE_LITTLE_ENDIAN
262 #endif
264 #ifdef __MIPSEL__
265 #define __IEEE_LITTLE_ENDIAN
266 #endif
267 #ifdef __MIPSEB__
268 #define __IEEE_BIG_ENDIAN
269 #endif
271 #ifdef __MMIX__
272 #define __IEEE_BIG_ENDIAN
273 #endif
275 #ifdef __D30V__
276 #define __IEEE_BIG_ENDIAN
277 #endif
279 /* necv70 was __IEEE_LITTLE_ENDIAN. */
281 #ifdef __W65__
282 #define __IEEE_LITTLE_ENDIAN
283 #define _DOUBLE_IS_32BITS
284 #endif
286 #if defined(__Z8001__) || defined(__Z8002__)
287 #define __IEEE_BIG_ENDIAN
288 #endif
290 #ifdef __m88k__
291 #define __IEEE_BIG_ENDIAN
292 #endif
294 #ifdef __mn10300__
295 #define __IEEE_LITTLE_ENDIAN
296 #endif
298 #ifdef __mn10200__
299 #define __IEEE_LITTLE_ENDIAN
300 #define _DOUBLE_IS_32BITS
301 #endif
303 #ifdef __v800
304 #define __IEEE_LITTLE_ENDIAN
305 #endif
307 #ifdef __v850
308 #define __IEEE_LITTLE_ENDIAN
309 #endif
311 #ifdef __D10V__
312 #define __IEEE_BIG_ENDIAN
313 #if __DOUBLE__ == 32
314 #define _DOUBLE_IS_32BITS
315 #endif
316 #endif
318 #ifdef __PPC__
319 #if (defined(_BIG_ENDIAN) && _BIG_ENDIAN) || (defined(_AIX) && _AIX)
320 #define __IEEE_BIG_ENDIAN
321 #else
322 #if (defined(_LITTLE_ENDIAN) && _LITTLE_ENDIAN) || (defined(__sun__) && __sun__) || (defined(_WIN32) && _WIN32)
323 #define __IEEE_LITTLE_ENDIAN
324 #endif
325 #endif
326 #endif
328 #ifdef __xstormy16__
329 #define __IEEE_LITTLE_ENDIAN
330 #endif
332 #ifdef __arc__
333 #ifdef __big_endian__
334 #define __IEEE_BIG_ENDIAN
335 #else
336 #define __IEEE_LITTLE_ENDIAN
337 #endif
338 #endif
340 #ifdef __ARC64__
341 #define __IEEE_LITTLE_ENDIAN
342 #endif
344 #ifdef __CRX__
345 #define __IEEE_LITTLE_ENDIAN
346 #endif
348 #ifdef __CSKY__
349 #ifdef __CSKYBE__
350 #define __IEEE_BIG_ENDIAN
351 #else
352 #define __IEEE_LITTLE_ENDIAN
353 #endif
354 #endif
356 #ifdef __fr30__
357 #define __IEEE_BIG_ENDIAN
358 #endif
360 #ifdef __FT32__
361 #define __IEEE_LITTLE_ENDIAN
362 #endif
364 #ifdef __mcore__
365 #define __IEEE_BIG_ENDIAN
366 #endif
368 #ifdef __mt__
369 #define __IEEE_BIG_ENDIAN
370 #endif
372 #ifdef __frv__
373 #define __IEEE_BIG_ENDIAN
374 #endif
376 #ifdef __moxie__
377 #ifdef __MOXIE_BIG_ENDIAN__
378 #define __IEEE_BIG_ENDIAN
379 #else
380 #define __IEEE_LITTLE_ENDIAN
381 #endif
382 #endif
384 #ifdef __ia64__
385 #ifdef __BIG_ENDIAN__
386 #define __IEEE_BIG_ENDIAN
387 #else
388 #define __IEEE_LITTLE_ENDIAN
389 #endif
390 #endif
392 #ifdef __AVR__
393 #define __IEEE_LITTLE_ENDIAN
394 #define _DOUBLE_IS_32BITS
395 #endif
397 #if defined(__or1k__) || defined(__OR1K__) || defined(__OR1KND__)
398 #define __IEEE_BIG_ENDIAN
399 #endif
401 #ifdef __IP2K__
402 #define __IEEE_BIG_ENDIAN
403 #define __SMALL_BITFIELDS
404 #define _DOUBLE_IS_32BITS
405 #endif
407 #ifdef __iq2000__
408 #define __IEEE_BIG_ENDIAN
409 #endif
411 #ifdef __MAVERICK__
412 #ifdef __ARMEL__
413 # define __IEEE_LITTLE_ENDIAN
414 #else /* must be __ARMEB__ */
415 # define __IEEE_BIG_ENDIAN
416 #endif /* __ARMEL__ */
417 #endif /* __MAVERICK__ */
419 #ifdef __m32c__
420 #define __IEEE_LITTLE_ENDIAN
421 #define __SMALL_BITFIELDS
422 #endif
424 #ifdef __CRIS__
425 #define __IEEE_LITTLE_ENDIAN
426 #endif
428 #ifdef __BFIN__
429 #define __IEEE_LITTLE_ENDIAN
430 #endif
432 #ifdef __x86_64__
433 #define __IEEE_LITTLE_ENDIAN
434 # define _SUPPORTS_ERREXCEPT
435 #endif
437 #ifdef __mep__
438 #ifdef __LITTLE_ENDIAN__
439 #define __IEEE_LITTLE_ENDIAN
440 #else
441 #define __IEEE_BIG_ENDIAN
442 #endif
443 #endif
445 #ifdef __MICROBLAZE__
446 #ifndef __MICROBLAZEEL__
447 #define __IEEE_BIG_ENDIAN
448 #else
449 #define __IEEE_LITTLE_ENDIAN
450 #endif
451 #endif
453 #ifdef __MSP430__
454 #define __IEEE_LITTLE_ENDIAN
455 #define __SMALL_BITFIELDS /* 16 Bit INT */
456 #endif
458 #ifdef __PRU__
459 #define __IEEE_LITTLE_ENDIAN
460 #endif
462 #ifdef __RL78__
463 #define __IEEE_LITTLE_ENDIAN
464 #define __SMALL_BITFIELDS /* 16 Bit INT */
465 #ifndef __RL78_64BIT_DOUBLES__
466 #define _DOUBLE_IS_32BITS
467 #endif
468 #endif
470 #ifdef __RX__
472 #ifdef __RX_BIG_ENDIAN__
473 #define __IEEE_BIG_ENDIAN
474 #else
475 #define __IEEE_LITTLE_ENDIAN
476 #endif
478 #ifndef __RX_64BIT_DOUBLES__
479 #define _DOUBLE_IS_32BITS
480 #endif
482 #ifdef __RX_16BIT_INTS__
483 #define __SMALL_BITFIELDS
484 #endif
486 #endif
488 #if (defined(__CR16__) || defined(__CR16C__) ||defined(__CR16CP__))
489 #define __IEEE_LITTLE_ENDIAN
490 #define __SMALL_BITFIELDS /* 16 Bit INT */
491 #endif
493 #ifdef __NIOS2__
494 # ifdef __nios2_big_endian__
495 # define __IEEE_BIG_ENDIAN
496 # else
497 # define __IEEE_LITTLE_ENDIAN
498 # endif
499 #endif
501 #ifdef __VISIUM__
502 #define __IEEE_BIG_ENDIAN
503 #endif
505 #ifdef __AMDGCN__
506 #define __IEEE_LITTLE_ENDIAN
507 #endif
509 #ifdef __XTENSA_EL__
510 #define __IEEE_LITTLE_ENDIAN
511 #endif
513 #ifdef __XTENSA_EB__
514 #define __IEEE_BIG_ENDIAN
515 #endif
517 #ifdef __CYGWIN__
518 #define __OBSOLETE_MATH_DEFAULT 0
519 #endif
521 #ifndef __OBSOLETE_MATH_DEFAULT
522 /* Use old math code by default. */
523 #define __OBSOLETE_MATH_DEFAULT 1
524 #endif
525 #ifndef __OBSOLETE_MATH
526 #define __OBSOLETE_MATH __OBSOLETE_MATH_DEFAULT
527 #endif
529 #ifndef __IEEE_BIG_ENDIAN
530 #ifndef __IEEE_LITTLE_ENDIAN
531 #error Endianess not declared!!
532 #endif /* not __IEEE_LITTLE_ENDIAN */
533 #endif /* not __IEEE_BIG_ENDIAN */
535 #endif /* not __IEEE_LITTLE_ENDIAN */
536 #endif /* not __IEEE_BIG_ENDIAN */