Changeset 94253 in vbox for trunk/include/iprt/types.h
- Timestamp:
- Mar 15, 2022 10:32:54 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/iprt/types.h
r93906 r94253 978 978 * Extended Double precision floating point format (80-bit). 979 979 */ 980 # pragma pack(1)980 # pragma pack(1) 981 981 typedef union RTFLOAT80U 982 982 { … … 1001 1001 } s; 1002 1002 1003 # ifdef RT_COMPILER_GROKS_64BIT_BITFIELDS 1004 /** 64-bit bitfields exposing the J bit and the fraction. */ 1005 RT_GCC_EXTENSION struct 1006 { 1007 # ifdef RT_BIG_ENDIAN 1008 /** The sign indicator. */ 1009 RT_GCC_EXTENSION uint16_t fSign : 1; 1010 /** The exponent (offseted by 16383). */ 1011 RT_GCC_EXTENSION uint16_t uExponent : 15; 1012 /** The J bit, aka the integer bit. */ 1013 RT_GCC_EXTENSION uint64_t fInteger : 1; 1014 /** The fraction. */ 1015 RT_GCC_EXTENSION uint64_t u63Fraction : 63; 1016 # else 1017 /** The fraction. */ 1018 RT_GCC_EXTENSION uint64_t u63Fraction : 63; 1019 /** The J bit, aka the integer bit. */ 1020 RT_GCC_EXTENSION uint64_t fInteger : 1; 1021 /** The exponent (offseted by 16383). */ 1022 RT_GCC_EXTENSION uint16_t uExponent : 15; 1023 /** The sign indicator. */ 1024 RT_GCC_EXTENSION uint16_t fSign : 1; 1025 # endif 1026 } sj64; 1027 # endif 1028 1003 1029 /** 64-bit view. */ 1004 1030 uint64_t au64[1]; … … 1010 1036 uint8_t au8[10]; 1011 1037 } RTFLOAT80U; 1012 # pragma pack()1038 # pragma pack() 1013 1039 /** Pointer to a extended precision floating point format union. */ 1014 1040 typedef RTFLOAT80U RT_FAR *PRTFLOAT80U; 1015 1041 /** Pointer to a const extended precision floating point format union. */ 1016 1042 typedef const RTFLOAT80U RT_FAR *PCRTFLOAT80U; 1043 /** RTFLOAT80U initializer. */ 1044 # ifdef RT_BIG_ENDIAN 1045 # define RTFLOAT80U_INIT(a_fSign, a_uMantissa, a_uExponent) { { (a_fSign), (a_uExponent), (a_uMantissa) } } 1046 # else 1047 # define RTFLOAT80U_INIT(a_fSign, a_uMantissa, a_uExponent) { { (a_uMantissa), (a_uExponent), (a_fSign) } } 1048 # endif 1049 # define RTFLOAT80U_INIT_C(a_fSign, a_uMantissa, a_uExponent) RTFLOAT80U_INIT((a_fSign), (a_uExponent), UINT64_C(a_uMantissa)) 1050 1051 /** Check if two 80-bit floating values are identical (memcmp, not 1052 * numberically). */ 1053 # define RTFLOAT80U_ARE_IDENTICAL(a_pLeft, a_pRight) \ 1054 ( (a_pLeft)->au64[0] == (a_pRight)->au64[0] \ 1055 && (a_pLeft)->au16[4] == (a_pRight)->au16[4] ) 1017 1056 1018 1057 … … 1020 1059 * A variant of RTFLOAT80U that may be larger than 80-bits depending on how the 1021 1060 * compiler implements long double. 1022 */ 1023 #pragma pack(1) 1061 * 1062 * @note On AMD64 systems implementing the System V ABI, this will be 16 bytes! 1063 * The last 6 bytes are unused padding taken up by the long double view. 1064 */ 1065 # pragma pack(1) 1024 1066 typedef union RTFLOAT80U2 1025 1067 { 1026 #ifdef RT_COMPILER_WITH_80BIT_LONG_DOUBLE1027 /** Long double view. */1028 long double lrd;1029 #endif1030 1068 /** Format using bitfields. */ 1031 1069 RT_GCC_EXTENSION struct 1032 1070 { 1033 # ifdef RT_BIG_ENDIAN1071 # ifdef RT_BIG_ENDIAN 1034 1072 /** The sign indicator. */ 1035 1073 RT_GCC_EXTENSION uint16_t fSign : 1; … … 1038 1076 /** The mantissa. */ 1039 1077 uint64_t u64Mantissa; 1040 # else1078 # else 1041 1079 /** The mantissa. */ 1042 1080 uint64_t u64Mantissa; … … 1045 1083 /** The sign indicator. */ 1046 1084 RT_GCC_EXTENSION uint16_t fSign : 1; 1047 # endif1085 # endif 1048 1086 } s; 1049 1087 1050 1088 /** Bitfield exposing the J bit and the fraction. */ 1051 RT_GCC_EXTENSION struct1052 {1053 #ifdef RT_BIG_ENDIAN1054 /** The sign indicator. */1055 RT_GCC_EXTENSION uint16_t fSign : 1;1056 /** The exponent (offseted by 16383). */1057 RT_GCC_EXTENSION uint16_t uExponent : 15;1058 /** The J bit, aka the integer bit. */1059 uint32_t fInteger;1060 /** The fraction, bits 32 thru 62. */1061 uint32_t u31FractionHigh : 31;1062 /** The fraction, bits 0 thru 31. */1063 uint32_t u32FractionLow : 32;1064 #else1065 /** The fraction, bits 0 thru 31. */1066 uint32_t u32FractionLow : 32;1067 /** The fraction, bits 32 thru 62. */1068 uint32_t u31FractionHigh : 31;1069 /** The J bit, aka the integer bit. */1070 uint32_t fInteger;1071 /** The exponent (offseted by 16383). */1072 RT_GCC_EXTENSION uint16_t uExponent : 15;1073 /** The sign indicator. */1074 RT_GCC_EXTENSION uint16_t fSign : 1;1075 #endif1076 } sj;1077 1078 #ifdef RT_COMPILER_GROKS_64BIT_BITFIELDS1079 /** 64-bit bitfields exposing the J bit and the fraction. */1080 1089 RT_GCC_EXTENSION struct 1081 1090 { … … 1086 1095 RT_GCC_EXTENSION uint16_t uExponent : 15; 1087 1096 /** The J bit, aka the integer bit. */ 1097 uint32_t fInteger : 1; 1098 /** The fraction, bits 32 thru 62. */ 1099 uint32_t u31FractionHigh : 31; 1100 /** The fraction, bits 0 thru 31. */ 1101 uint32_t u32FractionLow : 32; 1102 # else 1103 /** The fraction, bits 0 thru 31. */ 1104 uint32_t u32FractionLow : 32; 1105 /** The fraction, bits 32 thru 62. */ 1106 uint32_t u31FractionHigh : 31; 1107 /** The J bit, aka the integer bit. */ 1108 uint32_t fInteger : 1; 1109 /** The exponent (offseted by 16383). */ 1110 RT_GCC_EXTENSION uint16_t uExponent : 15; 1111 /** The sign indicator. */ 1112 RT_GCC_EXTENSION uint16_t fSign : 1; 1113 # endif 1114 } sj; 1115 1116 # ifdef RT_COMPILER_GROKS_64BIT_BITFIELDS 1117 /** 64-bit bitfields exposing the J bit and the fraction. */ 1118 RT_GCC_EXTENSION struct 1119 { 1120 # ifdef RT_BIG_ENDIAN 1121 /** The sign indicator. */ 1122 RT_GCC_EXTENSION uint16_t fSign : 1; 1123 /** The exponent (offseted by 16383). */ 1124 RT_GCC_EXTENSION uint16_t uExponent : 15; 1125 /** The J bit, aka the integer bit. */ 1088 1126 RT_GCC_EXTENSION uint64_t fInteger : 1; 1089 1127 /** The fraction. */ 1090 1128 RT_GCC_EXTENSION uint64_t u63Fraction : 63; 1091 # else1129 # else 1092 1130 /** The fraction. */ 1093 1131 RT_GCC_EXTENSION uint64_t u63Fraction : 63; … … 1098 1136 /** The sign indicator. */ 1099 1137 RT_GCC_EXTENSION uint16_t fSign : 1; 1138 # endif 1139 } sj64; 1100 1140 # endif 1101 } sj64; 1102 #endif 1103 1141 1142 # ifdef RT_COMPILER_WITH_80BIT_LONG_DOUBLE 1143 /** Long double view. */ 1144 long double lrd; 1145 # endif 1104 1146 /** 64-bit view. */ 1105 1147 uint64_t au64[1]; … … 1111 1153 uint8_t au8[10]; 1112 1154 } RTFLOAT80U2; 1113 # pragma pack()1155 # pragma pack() 1114 1156 /** Pointer to a extended precision floating point format union, 2nd 1115 1157 * variant. */
Note:
See TracChangeset
for help on using the changeset viewer.