2021-12-01 05:11:32 +08:00
|
|
|
#ifndef _MACHINE_IEEE_H_
|
|
|
|
#define _MACHINE_IEEE_H_
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <sys/cdefs.h>
|
|
|
|
#include <machine/ieeefp.h>
|
|
|
|
#include <float.h>
|
|
|
|
|
|
|
|
#if LDBL_MANT_DIG == 24
|
|
|
|
#define EXT_IMPLICIT_NBIT
|
|
|
|
#define EXT_TO_ARRAY32(p, a) do { \
|
|
|
|
(a)[0] = (p)->ext_frac; \
|
|
|
|
} while (0)
|
|
|
|
#ifdef __IEEE_LITTLE_ENDIAN
|
|
|
|
struct ieee_ext {
|
2022-05-04 21:08:44 +08:00
|
|
|
uint32_t ext_frac:23;
|
|
|
|
uint32_t ext_exp:8;
|
|
|
|
uint32_t ext_sign:1;
|
2021-12-01 05:11:32 +08:00
|
|
|
};
|
|
|
|
#endif
|
|
|
|
#ifdef __IEEE_BIG_ENDIAN
|
|
|
|
struct ieee_ext {
|
|
|
|
#ifndef ___IEEE_BYTES_LITTLE_ENDIAN
|
2022-05-04 21:08:44 +08:00
|
|
|
uint32_t ext_sign:1;
|
|
|
|
uint32_t ext_exp:8;
|
|
|
|
uint32_t ext_frac:23;
|
2021-12-01 05:11:32 +08:00
|
|
|
#else /* ARMEL without __VFP_FP__ */
|
2022-05-04 21:08:44 +08:00
|
|
|
uint32_t ext_frac:23;
|
|
|
|
uint32_t ext_exp:8;
|
|
|
|
uint32_t ext_sign:1;
|
2021-12-01 05:11:32 +08:00
|
|
|
#endif
|
|
|
|
};
|
|
|
|
#endif
|
|
|
|
#elif LDBL_MANT_DIG == 53
|
|
|
|
#define EXT_IMPLICIT_NBIT
|
|
|
|
#define EXT_TO_ARRAY32(p, a) do { \
|
|
|
|
(a)[0] = (p)->ext_fracl; \
|
|
|
|
(a)[1] = (p)->ext_frach; \
|
|
|
|
} while (0)
|
|
|
|
#ifdef __IEEE_LITTLE_ENDIAN
|
|
|
|
struct ieee_ext {
|
2022-05-04 21:08:44 +08:00
|
|
|
uint32_t ext_fracl;
|
|
|
|
uint32_t ext_frach:20;
|
|
|
|
uint32_t ext_exp:11;
|
|
|
|
uint32_t ext_sign:1;
|
2021-12-01 05:11:32 +08:00
|
|
|
};
|
|
|
|
#endif
|
|
|
|
#ifdef __IEEE_BIG_ENDIAN
|
|
|
|
struct ieee_ext {
|
|
|
|
#ifndef ___IEEE_BYTES_LITTLE_ENDIAN
|
2022-05-04 21:08:44 +08:00
|
|
|
uint32_t ext_sign:1;
|
|
|
|
uint32_t ext_exp:11;
|
|
|
|
uint32_t ext_frach:20;
|
2021-12-01 05:11:32 +08:00
|
|
|
#else /* ARMEL without __VFP_FP__ */
|
2022-05-04 21:08:44 +08:00
|
|
|
uint32_t ext_frach:20;
|
|
|
|
uint32_t ext_exp:11;
|
|
|
|
uint32_t ext_sign:1;
|
2021-12-01 05:11:32 +08:00
|
|
|
#endif
|
2022-05-04 21:08:44 +08:00
|
|
|
uint32_t ext_fracl;
|
2021-12-01 05:11:32 +08:00
|
|
|
};
|
|
|
|
#endif
|
|
|
|
#elif LDBL_MANT_DIG == 64
|
|
|
|
#define EXT_TO_ARRAY32(p, a) do { \
|
|
|
|
(a)[0] = (p)->ext_fracl; \
|
|
|
|
(a)[1] = (p)->ext_frach; \
|
|
|
|
} while (0)
|
|
|
|
#ifdef __IEEE_LITTLE_ENDIAN /* for Intel CPU */
|
|
|
|
struct ieee_ext {
|
2022-05-04 21:08:44 +08:00
|
|
|
uint32_t ext_fracl;
|
|
|
|
uint32_t ext_frach;
|
|
|
|
uint32_t ext_exp:15;
|
|
|
|
uint32_t ext_sign:1;
|
|
|
|
uint32_t ext_padl:16;
|
|
|
|
uint32_t ext_padh;
|
2021-12-01 05:11:32 +08:00
|
|
|
};
|
|
|
|
#endif
|
|
|
|
#ifdef __IEEE_BIG_ENDIAN
|
|
|
|
struct ieee_ext {
|
|
|
|
#ifndef ___IEEE_BYTES_LITTLE_ENDIAN /* for m68k */
|
2022-05-04 21:08:44 +08:00
|
|
|
uint32_t ext_sign:1;
|
|
|
|
uint32_t ext_exp:15;
|
|
|
|
uint32_t ext_pad:16;
|
2021-12-01 05:11:32 +08:00
|
|
|
#else /* ARM FPA10 math coprocessor */
|
2022-05-04 21:08:44 +08:00
|
|
|
uint32_t ext_exp:15;
|
|
|
|
uint32_t ext_pad:16;
|
|
|
|
uint32_t ext_sign:1;
|
2021-12-01 05:11:32 +08:00
|
|
|
#endif
|
2022-05-04 21:08:44 +08:00
|
|
|
uint32_t ext_frach;
|
|
|
|
uint32_t ext_fracl;
|
2021-12-01 05:11:32 +08:00
|
|
|
};
|
|
|
|
#endif
|
|
|
|
#elif LDBL_MANT_DIG == 113
|
|
|
|
#define EXT_IMPLICIT_NBIT
|
|
|
|
#define EXT_TO_ARRAY32(p, a) do { \
|
|
|
|
(a)[0] = (p)->ext_fracl; \
|
|
|
|
(a)[1] = (p)->ext_fraclm; \
|
|
|
|
(a)[2] = (p)->ext_frachm; \
|
|
|
|
(a)[3] = (p)->ext_frach; \
|
|
|
|
} while (0)
|
|
|
|
#ifdef __IEEE_LITTLE_ENDIAN
|
|
|
|
struct ieee_ext {
|
2022-05-04 21:08:44 +08:00
|
|
|
uint32_t ext_fracl;
|
|
|
|
uint32_t ext_fraclm;
|
|
|
|
uint32_t ext_frachm;
|
|
|
|
uint32_t ext_frach:16;
|
|
|
|
uint32_t ext_exp:15;
|
|
|
|
uint32_t ext_sign:1;
|
2021-12-01 05:11:32 +08:00
|
|
|
};
|
|
|
|
#endif
|
|
|
|
#ifdef __IEEE_BIG_ENDIAN
|
|
|
|
struct ieee_ext {
|
|
|
|
#ifndef ___IEEE_BYTES_LITTLE_ENDIAN
|
2022-05-04 21:08:44 +08:00
|
|
|
uint32_t ext_sign:1;
|
|
|
|
uint32_t ext_exp:15;
|
|
|
|
uint32_t ext_frach:16;
|
2021-12-01 05:11:32 +08:00
|
|
|
#else /* ARMEL without __VFP_FP__ */
|
2022-05-04 21:08:44 +08:00
|
|
|
uint32_t ext_frach:16;
|
|
|
|
uint32_t ext_exp:15;
|
|
|
|
uint32_t ext_sign:1;
|
2021-12-01 05:11:32 +08:00
|
|
|
#endif
|
2022-05-04 21:08:44 +08:00
|
|
|
uint32_t ext_frachm;
|
|
|
|
uint32_t ext_fraclm;
|
|
|
|
uint32_t ext_fracl;
|
2021-12-01 05:11:32 +08:00
|
|
|
};
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif /* _MACHINE_IEEE_H_ */
|