1 /****************************************************************************** 2 Copyright (c) 2007-2011, Intel Corp. 3 All rights reserved. 4 5 Redistribution and use in source and binary forms, with or without 6 modification, are permitted provided that the following conditions are met: 7 8 * Redistributions of source code must retain the above copyright notice, 9 this list of conditions and the following disclaimer. 10 * Redistributions in binary form must reproduce the above copyright 11 notice, this list of conditions and the following disclaimer in the 12 documentation and/or other materials provided with the distribution. 13 * Neither the name of Intel Corporation nor the names of its contributors 14 may be used to endorse or promote products derived from this software 15 without specific prior written permission. 16 17 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 18 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 21 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 22 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 23 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 24 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 25 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 26 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 27 THE POSSIBILITY OF SUCH DAMAGE. 28 ******************************************************************************/ 29 30 #ifndef F_FORMAT_H 31 #define F_FORMAT_H 32 33 34 /* This file contains definitions that are related to floating formats. 35 36 We assume that the floating point number represention is based on the 37 fact that every non-zero real number, x, can be uniquely represented as 38 39 x = (-1)^s * f * 2^e where 2^NORM <= f < 2^(NORM + 1) 40 41 We also assume that the bit representation of floating point numbers is 42 divided into three disjoint fields defined by the following mnemonics: 43 44 NAME WIDTH START POSITION CONTIGUOUS? 45 -------- ----- -------------- ----------- 46 Sign bit 1 SIGN_BIT_POS Yes 47 Exponent EXP_WIDTH EXP_POS Yes 48 Mantissa PRECISION - 1 LSB_POS Not for VAX 49 50 Ignoring denormalized numbers, NANs and infinities, the values of these 51 fields are defined as follows: 52 53 Sign bit: = 0 if x >= 0 54 = 1 if x < 0 55 56 Exponent: = 0 if x = 0 57 = (e + EXP_BIAS) otherwise 58 59 Mantissa: = 0 if x = 0 60 = rnd(f) - 2^NORM otherwise 61 (rnd(f) is f limited to PRECISION bits) 62 63 */ 64 65 66 #undef F_FORMAT 67 #undef VAX_FLOATING 68 #undef IEEE_FLOATING 69 #undef SINGLE_PRECISION 70 #undef DOUBLE_PRECISION 71 #undef QUAD_PRECISION 72 73 #if (defined(f_floating) || defined(F_FLOATING) || defined(f_float) || defined(F_FLOAT)) 74 75 # define VAX_FLOATING 1 76 # define F_FORMAT f_floating 77 # define SINGLE_PRECISION 1 78 # define R_PREC_CHAR S 79 # define F_PREC_CHAR S 80 # define B_PREC_CHAR D 81 82 #elif (defined(d_floating) || defined(D_FLOATING) || defined(d_float) || defined(D_FLOAT)) 83 84 # define VAX_FLOATING 1 85 # define F_FORMAT d_floating 86 # define DOUBLE_PRECISION 1 87 # define R_PREC_CHAR S 88 # define F_PREC_CHAR D 89 # define B_PREC_CHAR D 90 91 #elif (defined(g_floating) || defined(G_FLOATING) || defined(g_float) || defined(G_FLOAT)) 92 93 # define VAX_FLOATING 1 94 # define F_FORMAT g_floating 95 # define DOUBLE_PRECISION 1 96 # define R_PREC_CHAR S 97 # define F_PREC_CHAR D 98 # define B_PREC_CHAR D 99 100 #elif (defined(h_floating) || defined(H_FLOATING) || defined(h_float) || defined(H_FLOAT)) 101 102 # define VAX_FLOATING 1 103 # define F_FORMAT h_floating 104 # define QUAD_PRECISION 1 105 # define R_PREC_CHAR D 106 # define F_PREC_CHAR Q 107 # define B_PREC_CHAR Q 108 109 #elif (defined(s_floating) || defined(S_FLOATING) || defined(s_float) || defined(S_FLOAT)) 110 111 # define IEEE_FLOATING 1 112 # define F_FORMAT s_floating 113 # define SINGLE_PRECISION 1 114 # define R_PREC_CHAR S 115 # define F_PREC_CHAR S 116 # define B_PREC_CHAR D 117 118 #elif (defined(t_floating) || defined(T_FLOATING) || defined(t_float) || defined(T_FLOAT)) 119 120 # define IEEE_FLOATING 1 121 # define F_FORMAT t_floating 122 # define DOUBLE_PRECISION 1 123 # define R_PREC_CHAR S 124 # define F_PREC_CHAR D 125 # define B_PREC_CHAR D 126 127 #elif (defined(x_floating) || defined(X_FLOATING) || defined(x_float) || defined(X_FLOAT)) 128 129 # define IEEE_FLOATING 1 130 # define F_FORMAT x_floating 131 # define QUAD_PRECISION 1 132 # define R_PREC_CHAR D 133 # define F_PREC_CHAR Q 134 # define B_PREC_CHAR Q 135 136 #else 137 138 # define NO_FLOATING 1 139 140 #endif 141 142 #undef f_floating 143 #undef d_floating 144 #undef g_floating 145 #undef h_floating 146 #undef s_floating 147 #undef t_floating 148 #undef x_floating 149 150 #define f_floating 1 151 #define d_floating 2 152 #define g_floating 3 153 #define h_floating 4 154 #define s_floating 5 155 #define t_floating 6 156 #define x_floating 7 157 158 #define VAX_TYPES ((1 << f_floating) + (1 << g_floating) + (1 << h_floating)) 159 #define IEEE_TYPES ((1 << s_floating) + (1 << t_floating) + (1 << x_floating)) 160 161 162 163 #define S_TYPE float 164 #define D_TYPE double 165 #if !defined(Q_TYPE) 166 # if BITS_PER_LONG_DOUBLE == 128 && defined(LONG_DOUBLE_128_TYPE) 167 # define Q_TYPE LONG_DOUBLE_128_TYPE 168 # else 169 # define Q_TYPE long double 170 # endif 171 #endif 172 173 #define BITS_PER_S_TYPE BITS_PER_FLOAT 174 #define BITS_PER_D_TYPE BITS_PER_DOUBLE 175 #define BITS_PER_Q_TYPE BITS_PER_LONG_DOUBLE 176 177 /* 178 * round up to next quad word boundrary where appropriate - Intel 179 * to get the alignment bits 180 */ 181 #define ALIGNED_BITS_PER_Q_TYPE ((BITS_PER_Q_TYPE - 1 + 32)/32)*32 182 183 #define I8S_PER_S_TYPE (BITS_PER_S_TYPE / 8) 184 #define I8S_PER_D_TYPE (BITS_PER_D_TYPE / 8) 185 #define I8S_PER_Q_TYPE (ALIGNED_BITS_PER_Q_TYPE / 8) 186 187 #define I16S_PER_S_TYPE (BITS_PER_S_TYPE / 16) 188 #define I16S_PER_D_TYPE (BITS_PER_D_TYPE / 16) 189 #define I16S_PER_Q_TYPE (ALIGNED_BITS_PER_Q_TYPE / 16) 190 191 #define I32S_PER_S_TYPE (BITS_PER_S_TYPE / 32) 192 #define I32S_PER_D_TYPE (BITS_PER_D_TYPE / 32) 193 #define I32S_PER_Q_TYPE (ALIGNED_BITS_PER_Q_TYPE / 32) 194 195 #define I64S_PER_S_TYPE (BITS_PER_S_TYPE / 64) 196 #define I64S_PER_D_TYPE (BITS_PER_D_TYPE / 64) 197 #define I64S_PER_Q_TYPE (ALIGNED_BITS_PER_Q_TYPE / 64) 198 199 #define WORDS_PER_S_TYPE (BITS_PER_S_TYPE / BITS_PER_WORD) 200 #define WORDS_PER_D_TYPE (BITS_PER_D_TYPE / BITS_PER_WORD) 201 #define WORDS_PER_Q_TYPE (ALIGNED_BITS_PER_Q_TYPE / BITS_PER_WORD) 202 203 204 205 typedef struct { 206 S_TYPE r, i; 207 } S_COMPLEX; 208 209 typedef struct { 210 D_TYPE r, i; 211 } D_COMPLEX; 212 213 typedef struct { 214 Q_TYPE r, i; 215 } Q_COMPLEX; 216 217 #define F_COMPLEX_RETURN return 218 219 220 typedef union { 221 S_TYPE f; 222 #if (I8S_PER_S_TYPE > 0) 223 INT_8 i8[ I8S_PER_S_TYPE ]; 224 U_INT_8 u8[ I8S_PER_S_TYPE ]; 225 #endif 226 #if (I16S_PER_S_TYPE > 0) 227 INT_16 i16[ I16S_PER_S_TYPE ]; 228 U_INT_16 u16[ I16S_PER_S_TYPE ]; 229 #endif 230 #if (I32S_PER_S_TYPE > 0) 231 INT_32 i32[ I32S_PER_S_TYPE ]; 232 U_INT_32 u32[ I32S_PER_S_TYPE ]; 233 #endif 234 #if (I64S_PER_S_TYPE > 0) && defined(INT_64) 235 INT_64 i64[ I64S_PER_S_TYPE ]; 236 U_INT_64 u64[ I64S_PER_S_TYPE ]; 237 #endif 238 #if (WORDS_PER_S_TYPE > 0) 239 WORD iw[ WORDS_PER_S_TYPE ]; 240 U_WORD uw[ WORDS_PER_S_TYPE ]; 241 #endif 242 } S_UNION; 243 244 245 typedef union { 246 D_TYPE f; 247 #if (I8S_PER_D_TYPE > 0) 248 INT_8 i8[ I8S_PER_D_TYPE ]; 249 U_INT_8 u8[ I8S_PER_D_TYPE ]; 250 #endif 251 #if (I16S_PER_D_TYPE > 0) 252 INT_16 i16[ I16S_PER_D_TYPE ]; 253 U_INT_16 u16[ I16S_PER_D_TYPE ]; 254 #endif 255 #if (I32S_PER_D_TYPE > 0) 256 INT_32 i32[ I32S_PER_D_TYPE ]; 257 U_INT_32 u32[ I32S_PER_D_TYPE ]; 258 #endif 259 #if (I64S_PER_D_TYPE > 0) && defined(INT_64) 260 INT_64 i64[ I64S_PER_D_TYPE ]; 261 U_INT_64 u64[ I64S_PER_D_TYPE ]; 262 #endif 263 #if (WORDS_PER_D_TYPE > 0) 264 WORD iw[ WORDS_PER_D_TYPE ]; 265 U_WORD uw[ WORDS_PER_D_TYPE ]; 266 #endif 267 } D_UNION; 268 269 270 typedef union { 271 Q_TYPE f; 272 #if (I8S_PER_Q_TYPE > 0) 273 INT_8 i8[ I8S_PER_Q_TYPE ]; 274 U_INT_8 u8[ I8S_PER_Q_TYPE ]; 275 #endif 276 #if (I16S_PER_Q_TYPE > 0) 277 INT_16 i16[ I16S_PER_Q_TYPE ]; 278 U_INT_16 u16[ I16S_PER_Q_TYPE ]; 279 #endif 280 #if (I32S_PER_Q_TYPE > 0) 281 INT_32 i32[ I32S_PER_Q_TYPE ]; 282 U_INT_32 u32[ I32S_PER_Q_TYPE ]; 283 #endif 284 #if (I64S_PER_Q_TYPE > 0) && defined(INT_64) 285 INT_64 i64[ I64S_PER_Q_TYPE ]; 286 U_INT_64 u64[ I64S_PER_Q_TYPE ]; 287 #endif 288 #if (WORDS_PER_Q_TYPE > 0) 289 WORD iw[ WORDS_PER_Q_TYPE ]; 290 U_WORD uw[ WORDS_PER_Q_TYPE ]; 291 #endif 292 } Q_UNION; 293 294 295 #if (!defined(TABLE_WORD) || !defined(TABLE_WORDS_PER_Q_TYPE)) 296 # define BITS_PER_TABLE_WORD 32 297 # define TABLE_WORD U_INT_32 298 # define TABLE_WORDS_PER_Q_TYPE I32S_PER_Q_TYPE 299 #endif 300 301 typedef union { 302 #if (TABLE_WORDS_PER_Q_TYPE > 0) 303 TABLE_WORD it[ TABLE_WORDS_PER_Q_TYPE ]; 304 #else 305 TABLE_WORD it[ 1 ]; 306 #endif 307 Q_TYPE f; 308 } TABLE_UNION; 309 310 311 312 #if (VAX_FLOATING) || (ENDIANESS == big_endian) 313 314 # define UNION_IX(i_per_type, k) (k) 315 316 #else 317 318 # define UNION_IX(i_per_type, k) ( i_per_type - k - 1 ) 319 320 #endif 321 322 323 #define S_SIGNED_HI_16 i16[ UNION_IX(I16S_PER_S_TYPE,0) ] 324 #define S_SIGNED_HI_32 i32[ UNION_IX(I32S_PER_S_TYPE,0) ] 325 #define S_SIGNED_HI_64 i64[ UNION_IX(I64S_PER_S_TYPE,0) ] 326 #define S_SIGNED_LO1_16 i16[ UNION_IX(I16S_PER_S_TYPE,1) ] 327 #define S_SIGNED_LO1_32 i32[ UNION_IX(I32S_PER_S_TYPE,1) ] 328 #define S_SIGNED_LO1_64 i64[ UNION_IX(I64S_PER_S_TYPE,1) ] 329 #define S_SIGNED_LO2_16 i16[ UNION_IX(I16S_PER_S_TYPE,2) ] 330 #define S_SIGNED_LO2_32 i32[ UNION_IX(I32S_PER_S_TYPE,2) ] 331 #define S_SIGNED_LO2_64 i64[ UNION_IX(I64S_PER_S_TYPE,2) ] 332 #define S_SIGNED_LO3_16 i16[ UNION_IX(I16S_PER_S_TYPE,3) ] 333 #define S_SIGNED_LO3_32 i32[ UNION_IX(I32S_PER_S_TYPE,3) ] 334 #define S_SIGNED_LO3_64 i64[ UNION_IX(I64S_PER_S_TYPE,3) ] 335 #define S_SIGNED_LO_16 S_SIGNED_LO1_16 336 #define S_SIGNED_LO_32 S_SIGNED_LO1_32 337 #define S_SIGNED_LO_64 S_SIGNED_LO1_64 338 #define S_UNSIGNED_HI_16 u16[ UNION_IX(I16S_PER_S_TYPE,0) ] 339 #define S_UNSIGNED_HI_32 u32[ UNION_IX(I32S_PER_S_TYPE,0) ] 340 #define S_UNSIGNED_HI_64 u64[ UNION_IX(I64S_PER_S_TYPE,0) ] 341 #define S_UNSIGNED_LO1_16 u16[ UNION_IX(I16S_PER_S_TYPE,1) ] 342 #define S_UNSIGNED_LO1_32 u32[ UNION_IX(I32S_PER_S_TYPE,1) ] 343 #define S_UNSIGNED_LO1_64 u64[ UNION_IX(I64S_PER_S_TYPE,1) ] 344 #define S_UNSIGNED_LO2_16 u16[ UNION_IX(I16S_PER_S_TYPE,2) ] 345 #define S_UNSIGNED_LO2_32 u32[ UNION_IX(I32S_PER_S_TYPE,2) ] 346 #define S_UNSIGNED_LO2_64 u64[ UNION_IX(I64S_PER_S_TYPE,2) ] 347 #define S_UNSIGNED_LO3_16 u16[ UNION_IX(I16S_PER_S_TYPE,3) ] 348 #define S_UNSIGNED_LO3_32 u32[ UNION_IX(I32S_PER_S_TYPE,3) ] 349 #define S_UNSIGNED_LO3_64 u64[ UNION_IX(I64S_PER_S_TYPE,3) ] 350 #define S_UNSIGNED_LO_16 S_UNSIGNED_LO1_16 351 #define S_UNSIGNED_LO_32 S_UNSIGNED_LO1_32 352 #define S_UNSIGNED_LO_64 S_UNSIGNED_LO1_64 353 354 #define D_SIGNED_HI_16 i16[ UNION_IX(I16S_PER_D_TYPE,0) ] 355 #define D_SIGNED_HI_32 i32[ UNION_IX(I32S_PER_D_TYPE,0) ] 356 #define D_SIGNED_HI_64 i64[ UNION_IX(I64S_PER_D_TYPE,0) ] 357 #define D_SIGNED_LO1_16 i16[ UNION_IX(I16S_PER_D_TYPE,1) ] 358 #define D_SIGNED_LO1_32 i32[ UNION_IX(I32S_PER_D_TYPE,1) ] 359 #define D_SIGNED_LO1_64 i64[ UNION_IX(I64S_PER_D_TYPE,1) ] 360 #define D_SIGNED_LO2_16 i16[ UNION_IX(I16S_PER_D_TYPE,2) ] 361 #define D_SIGNED_LO2_32 i32[ UNION_IX(I32S_PER_D_TYPE,2) ] 362 #define D_SIGNED_LO2_64 i64[ UNION_IX(I64S_PER_D_TYPE,2) ] 363 #define D_SIGNED_LO3_16 i16[ UNION_IX(I16S_PER_D_TYPE,3) ] 364 #define D_SIGNED_LO3_32 i32[ UNION_IX(I32S_PER_D_TYPE,3) ] 365 #define D_SIGNED_LO3_64 i64[ UNION_IX(I64S_PER_D_TYPE,3) ] 366 #define D_SIGNED_LO_16 D_SIGNED_LO1_16 367 #define D_SIGNED_LO_32 D_SIGNED_LO1_32 368 #define D_SIGNED_LO_64 D_SIGNED_LO1_64 369 #define D_UNSIGNED_HI_16 u16[ UNION_IX(I16S_PER_D_TYPE,0) ] 370 #define D_UNSIGNED_HI_32 u32[ UNION_IX(I32S_PER_D_TYPE,0) ] 371 #define D_UNSIGNED_HI_64 u64[ UNION_IX(I64S_PER_D_TYPE,0) ] 372 #define D_UNSIGNED_LO1_16 u16[ UNION_IX(I16S_PER_D_TYPE,1) ] 373 #define D_UNSIGNED_LO1_32 u32[ UNION_IX(I32S_PER_D_TYPE,1) ] 374 #define D_UNSIGNED_LO1_64 u64[ UNION_IX(I64S_PER_D_TYPE,1) ] 375 #define D_UNSIGNED_LO2_16 u16[ UNION_IX(I16S_PER_D_TYPE,2) ] 376 #define D_UNSIGNED_LO2_32 u32[ UNION_IX(I32S_PER_D_TYPE,2) ] 377 #define D_UNSIGNED_LO2_64 u64[ UNION_IX(I64S_PER_D_TYPE,2) ] 378 #define D_UNSIGNED_LO3_16 u16[ UNION_IX(I16S_PER_D_TYPE,3) ] 379 #define D_UNSIGNED_LO3_32 u32[ UNION_IX(I32S_PER_D_TYPE,3) ] 380 #define D_UNSIGNED_LO3_64 u64[ UNION_IX(I64S_PER_D_TYPE,3) ] 381 #define D_UNSIGNED_LO_16 D_UNSIGNED_LO1_16 382 #define D_UNSIGNED_LO_32 D_UNSIGNED_LO1_32 383 #define D_UNSIGNED_LO_64 D_UNSIGNED_LO1_64 384 385 #define Q_SIGNED_HI_16 i16[ UNION_IX(I16S_PER_Q_TYPE,0) ] 386 #define Q_SIGNED_HI_32 i32[ UNION_IX(I32S_PER_Q_TYPE,0) ] 387 #define Q_SIGNED_HI_64 i64[ UNION_IX(I64S_PER_Q_TYPE,0) ] 388 #define Q_SIGNED_LO1_16 i16[ UNION_IX(I16S_PER_Q_TYPE,1) ] 389 #define Q_SIGNED_LO1_32 i32[ UNION_IX(I32S_PER_Q_TYPE,1) ] 390 #define Q_SIGNED_LO1_64 i64[ UNION_IX(I64S_PER_Q_TYPE,1) ] 391 #define Q_SIGNED_LO2_16 i16[ UNION_IX(I16S_PER_Q_TYPE,2) ] 392 #define Q_SIGNED_LO2_32 i32[ UNION_IX(I32S_PER_Q_TYPE,2) ] 393 #define Q_SIGNED_LO2_64 i64[ UNION_IX(I64S_PER_Q_TYPE,2) ] 394 #define Q_SIGNED_LO3_16 i16[ UNION_IX(I16S_PER_Q_TYPE,3) ] 395 #define Q_SIGNED_LO3_32 i32[ UNION_IX(I32S_PER_Q_TYPE,3) ] 396 #define Q_SIGNED_LO3_64 i64[ UNION_IX(I64S_PER_Q_TYPE,3) ] 397 #define Q_SIGNED_LO_16 Q_SIGNED_LO1_16 398 #define Q_SIGNED_LO_32 Q_SIGNED_LO1_32 399 #define Q_SIGNED_LO_64 Q_SIGNED_LO1_64 400 #define Q_UNSIGNED_HI_16 u16[ UNION_IX(I16S_PER_Q_TYPE,0) ] 401 #define Q_UNSIGNED_HI_32 u32[ UNION_IX(I32S_PER_Q_TYPE,0) ] 402 #define Q_UNSIGNED_HI_64 u64[ UNION_IX(I64S_PER_Q_TYPE,0) ] 403 #define Q_UNSIGNED_LO1_16 u16[ UNION_IX(I16S_PER_Q_TYPE,1) ] 404 #define Q_UNSIGNED_LO1_32 u32[ UNION_IX(I32S_PER_Q_TYPE,1) ] 405 #define Q_UNSIGNED_LO1_64 u64[ UNION_IX(I64S_PER_Q_TYPE,1) ] 406 #define Q_UNSIGNED_LO2_16 u16[ UNION_IX(I16S_PER_Q_TYPE,2) ] 407 #define Q_UNSIGNED_LO2_32 u32[ UNION_IX(I32S_PER_Q_TYPE,2) ] 408 #define Q_UNSIGNED_LO2_64 u64[ UNION_IX(I64S_PER_Q_TYPE,2) ] 409 #define Q_UNSIGNED_LO3_16 u16[ UNION_IX(I16S_PER_Q_TYPE,3) ] 410 #define Q_UNSIGNED_LO3_32 u32[ UNION_IX(I32S_PER_Q_TYPE,3) ] 411 #define Q_UNSIGNED_LO3_64 u64[ UNION_IX(I64S_PER_Q_TYPE,3) ] 412 #define Q_UNSIGNED_LO_16 Q_UNSIGNED_LO1_16 413 #define Q_UNSIGNED_LO_32 Q_UNSIGNED_LO1_32 414 #define Q_UNSIGNED_LO_64 Q_UNSIGNED_LO1_64 415 416 417 418 #if (WORDS_PER_S_TYPE > 0) 419 # define S_SIGNED_HI_WORD iw[ UNION_IX(WORDS_PER_S_TYPE,0) ] 420 # define S_UNSIGNED_HI_WORD uw[ UNION_IX(WORDS_PER_S_TYPE,0) ] 421 #else 422 # define S_SIGNED_HI_WORD PASTE_2(i, BITS_PER_S_TYPE)[0] 423 # define S_UNSIGNED_HI_WORD PASTE_2(u, BITS_PER_S_TYPE)[0] 424 #endif 425 426 #if (WORDS_PER_S_TYPE > 1) 427 # define S_SIGNED_LO1_WORD iw[ UNION_IX(WORDS_PER_S_TYPE,1) ] 428 # define S_UNSIGNED_LO1_WORD uw[ UNION_IX(WORDS_PER_S_TYPE,1) ] 429 #else 430 # define S_SIGNED_LO1_WORD S_SIGNED_HI_WORD 431 # define S_UNSIGNED_LO1_WORD S_UNSIGNED_HI_WORD 432 #endif 433 434 #if (WORDS_PER_S_TYPE > 2) 435 # define S_SIGNED_LO2_WORD iw[ UNION_IX(WORDS_PER_S_TYPE,2) ] 436 # define S_UNSIGNED_LO2_WORD uw[ UNION_IX(WORDS_PER_S_TYPE,2) ] 437 #else 438 # define S_SIGNED_LO2_WORD S_SIGNED_LO1_WORD 439 # define S_UNSIGNED_LO2_WORD S_UNSIGNED_LO1_WORD 440 #endif 441 442 #if (WORDS_PER_S_TYPE > 3) 443 # define S_SIGNED_LO3_WORD iw[ UNION_IX(WORDS_PER_S_TYPE,3) ] 444 # define S_UNSIGNED_LO3_WORD uw[ UNION_IX(WORDS_PER_S_TYPE,3) ] 445 #else 446 # define S_SIGNED_LO3_WORD S_SIGNED_LO2_WORD 447 # define S_UNSIGNED_LO3_WORD S_UNSIGNED_LO2_WORD 448 #endif 449 450 #define S_HI_WORD S_UNSIGNED_HI_WORD 451 #define S_LO1_WORD S_UNSIGNED_LO1_WORD 452 #define S_LO2_WORD S_UNSIGNED_LO2_WORD 453 #define S_LO3_WORD S_UNSIGNED_LO3_WORD 454 #define S_LO_WORD S_LO1_WORD 455 456 457 458 #if (WORDS_PER_D_TYPE > 0) 459 # define D_SIGNED_HI_WORD iw[ UNION_IX(WORDS_PER_D_TYPE,0) ] 460 # define D_UNSIGNED_HI_WORD uw[ UNION_IX(WORDS_PER_D_TYPE,0) ] 461 #else 462 # define D_SIGNED_HI_WORD PASTE_2(i, BITS_PER_D_TYPE)[0] 463 # define D_UNSIGNED_HI_WORD PASTE_2(u, BITS_PER_D_TYPE)[0] 464 #endif 465 466 #if (WORDS_PER_D_TYPE > 1) 467 # define D_SIGNED_LO1_WORD iw[ UNION_IX(WORDS_PER_D_TYPE,1) ] 468 # define D_UNSIGNED_LO1_WORD uw[ UNION_IX(WORDS_PER_D_TYPE,1) ] 469 #else 470 # define D_SIGNED_LO1_WORD D_SIGNED_HI_WORD 471 # define D_UNSIGNED_LO1_WORD D_UNSIGNED_HI_WORD 472 #endif 473 474 #if (WORDS_PER_D_TYPE > 2) 475 # define D_SIGNED_LO2_WORD iw[ UNION_IX(WORDS_PER_D_TYPE,2) ] 476 # define D_UNSIGNED_LO2_WORD uw[ UNION_IX(WORDS_PER_D_TYPE,2) ] 477 #else 478 # define D_SIGNED_LO2_WORD D_SIGNED_LO1_WORD 479 # define D_UNSIGNED_LO2_WORD D_UNSIGNED_LO1_WORD 480 #endif 481 482 #if (WORDS_PER_D_TYPE > 3) 483 # define D_SIGNED_LO3_WORD iw[ UNION_IX(WORDS_PER_D_TYPE,3) ] 484 # define D_UNSIGNED_LO3_WORD uw[ UNION_IX(WORDS_PER_D_TYPE,3) ] 485 #else 486 # define D_SIGNED_LO3_WORD D_SIGNED_LO2_WORD 487 # define D_UNSIGNED_LO3_WORD D_UNSIGNED_LO2_WORD 488 #endif 489 490 #define D_HI_WORD D_UNSIGNED_HI_WORD 491 #define D_LO1_WORD D_UNSIGNED_LO1_WORD 492 #define D_LO2_WORD D_UNSIGNED_LO2_WORD 493 #define D_LO3_WORD D_UNSIGNED_LO3_WORD 494 #define D_LO_WORD D_LO1_WORD 495 496 497 498 #if (WORDS_PER_Q_TYPE > 0) 499 # define Q_SIGNED_HI_WORD iw[ UNION_IX(WORDS_PER_Q_TYPE,0) ] 500 # define Q_UNSIGNED_HI_WORD uw[ UNION_IX(WORDS_PER_Q_TYPE,0) ] 501 #else 502 # define Q_SIGNED_HI_WORD PASTE_2(i, BITS_PER_Q_TYPE)[0] 503 # define Q_UNSIGNED_HI_WORD PASTE_2(u, BITS_PER_Q_TYPE)[0] 504 #endif 505 506 #if (WORDS_PER_Q_TYPE > 1) 507 # define Q_SIGNED_LO1_WORD iw[ UNION_IX(WORDS_PER_Q_TYPE,1) ] 508 # define Q_UNSIGNED_LO1_WORD uw[ UNION_IX(WORDS_PER_Q_TYPE,1) ] 509 #else 510 # define Q_SIGNED_LO1_WORD Q_SIGNED_HI_WORD 511 # define Q_UNSIGNED_LO1_WORD Q_UNSIGNED_HI_WORD 512 #endif 513 514 #if (WORDS_PER_Q_TYPE > 2) 515 # define Q_SIGNED_LO2_WORD iw[ UNION_IX(WORDS_PER_Q_TYPE,2) ] 516 # define Q_UNSIGNED_LO2_WORD uw[ UNION_IX(WORDS_PER_Q_TYPE,2) ] 517 #else 518 # define Q_SIGNED_LO2_WORD Q_SIGNED_LO1_WORD 519 # define Q_UNSIGNED_LO2_WORD Q_UNSIGNED_LO1_WORD 520 #endif 521 522 #if (WORDS_PER_Q_TYPE > 3) 523 # define Q_SIGNED_LO3_WORD iw[ UNION_IX(WORDS_PER_Q_TYPE,3) ] 524 # define Q_UNSIGNED_LO3_WORD uw[ UNION_IX(WORDS_PER_Q_TYPE,3) ] 525 #else 526 # define Q_SIGNED_LO3_WORD Q_SIGNED_LO2_WORD 527 # define Q_UNSIGNED_LO3_WORD Q_UNSIGNED_LO2_WORD 528 #endif 529 530 #define Q_HI_WORD Q_UNSIGNED_HI_WORD 531 #define Q_LO1_WORD Q_UNSIGNED_LO1_WORD 532 #define Q_LO2_WORD Q_UNSIGNED_LO2_WORD 533 #define Q_LO3_WORD Q_UNSIGNED_LO3_WORD 534 #define Q_LO_WORD Q_LO1_WORD 535 536 537 538 539 /* The t_xyz_POS constants below are not yet sufficiently general. 540 Currently, they assume 32 or 64 bits words. They should allow 16 bit 541 words, et cetera. */ 542 543 544 #if (VAX_FLOATING) 545 546 # define S_FORMAT f_floating 547 # define S_CHAR f 548 # define S_NORM (-1) 549 # define S_PRECISION 24 550 # define S_LSB_POS 16 551 # define S_MSB_POS 6 552 # define S_EXP_POS 7 553 # define S_EXP_BIAS 128 554 # define S_EXP_WIDTH 8 555 # define S_MIN_BIN_EXP -127 556 # define S_MAX_BIN_EXP 127 557 # define S_MIN_DEC_EXP -38 558 # define S_MAX_DEC_EXP 39 559 # define S_SIGN_BIT_POS 15 560 # undef S_25TH_BIT_POS 561 562 # if (F_FORMAT == d_floating) 563 564 # define D_FORMAT d_floating 565 # define D_CHAR d 566 # define D_NORM (-1) 567 # define D_PRECISION 56 568 # define D_LSB_POS (BITS_PER_WORD - 16) 569 # define D_MSB_POS 6 570 # define D_EXP_POS 7 571 # define D_EXP_BIAS 128 572 # define D_EXP_WIDTH 8 573 # define D_MIN_BIN_EXP -127 574 # define D_MAX_BIN_EXP 127 575 # define D_MIN_DEC_EXP -38 576 # define D_MAX_DEC_EXP 39 577 # define D_SIGN_BIT_POS 15 578 # define D_25TH_BIT_POS (BITS_PER_WORD - 17) 579 580 # else 581 582 # define D_FORMAT g_floating 583 # define D_CHAR g 584 # define D_NORM (-1) 585 # define D_PRECISION 53 586 # define D_LSB_POS (BITS_PER_WORD - 16) 587 # define D_MSB_POS 3 588 # define D_EXP_POS 4 589 # define D_EXP_BIAS 1024 590 # define D_EXP_WIDTH 11 591 # define D_MIN_BIN_EXP -1023 592 # define D_MAX_BIN_EXP 1023 593 # define D_MIN_DEC_EXP -308 594 # define D_MAX_DEC_EXP 308 595 # define D_SIGN_BIT_POS 15 596 # define D_25TH_BIT_POS (BITS_PER_WORD - 20) 597 598 # endif 599 600 # define Q_FORMAT h_floating 601 # define Q_CHAR h 602 # define Q_NORM (-1) 603 # define Q_PRECISION 113 604 # define Q_LSB_POS (BITS_PER_WORD - 16) 605 # define Q_MSB_POS 31 606 # define Q_EXP_POS 0 607 # define Q_EXP_BIAS 16384 608 # define Q_EXP_WIDTH 15 609 # define Q_MIN_BIN_EXP -16383 610 # define Q_MAX_BIN_EXP 16383 611 # define Q_MIN_DEC_EXP -4932 612 # define Q_MAX_DEC_EXP 4932 613 # define Q_SIGN_BIT_POS 15 614 615 616 #elif IEEE_FLOATING 617 618 # define S_FORMAT s_floating 619 # define S_CHAR s 620 # define S_NORM 0 621 # define S_PRECISION 24 622 # define S_LSB_POS 0 623 # define S_MSB_POS (BITS_PER_S_TYPE - S_EXP_WIDTH - 2) 624 # define S_EXP_POS (BITS_PER_S_TYPE - S_EXP_WIDTH - 1) 625 # define S_EXP_BIAS 127 626 # define S_EXP_WIDTH 8 627 # define S_MIN_BIN_EXP -126 628 # define S_MAX_BIN_EXP 127 629 # define S_MIN_DEC_EXP -45 630 # define S_MAX_DEC_EXP 39 631 # define S_SIGN_BIT_POS (BITS_PER_S_TYPE - 1) 632 # undef S_25TH_BIT_POS 633 634 # define D_FORMAT t_floating 635 # define D_CHAR t 636 # define D_NORM 0 637 # define D_PRECISION 53 638 # define D_LSB_POS 0 639 # define D_MSB_POS (BITS_PER_WORD - D_EXP_WIDTH - 2) 640 # define D_EXP_POS (BITS_PER_WORD - D_EXP_WIDTH - 1) 641 # define D_EXP_BIAS 1023 642 # define D_EXP_WIDTH 11 643 # define D_MIN_BIN_EXP -1022 644 # define D_MAX_BIN_EXP 1023 645 # define D_MIN_DEC_EXP -323 646 # define D_MAX_DEC_EXP 309 647 # define D_SIGN_BIT_POS (BITS_PER_WORD - 1) 648 # define D_25TH_BIT_POS 28 649 650 # define Q_FORMAT x_floating 651 # define Q_CHAR x 652 # define Q_NORM 0 653 # define Q_PRECISION 113 654 # define Q_LSB_POS 0 655 # define Q_MSB_POS (BITS_PER_WORD - Q_EXP_WIDTH - 2) 656 # define Q_EXP_POS (BITS_PER_WORD - Q_EXP_WIDTH - 1) 657 # define Q_EXP_BIAS 16383 658 # define Q_EXP_WIDTH 15 659 # define Q_MIN_BIN_EXP -16382 660 # define Q_MAX_BIN_EXP 16383 661 # define Q_MIN_DEC_EXP -4965 662 # define Q_MAX_DEC_EXP 4933 663 # define Q_SIGN_BIT_POS (BITS_PER_WORD - 1) 664 665 #endif 666 667 /* Don't define these symbols until the globals table is instantiated */ 668 669 #if defined(GLOBAL_TABLE_VALUES) 670 # if (ARCHITECTURE == mips) 671 # define X_NAN_HI 0x7fff7fff 672 # define T_NAN_HI 0x7ff7ffff 673 # define S_NAN_HI 0x7fbfffff 674 # define NAN_LO 0xffffffff 675 # elif (ARCHITECTURE == hp_pa) 676 # define X_NAN_HI 0x7fff4000 677 # define T_NAN_HI 0x7ff40000 678 # define S_NAN_HI 0x7fa00000 679 # define NAN_LO 0x00000000 680 # else 681 # define X_NAN_HI 0xffff8000 682 # define T_NAN_HI 0xfff80000 683 # define S_NAN_HI 0xffc00000 684 # define NAN_LO 0x00000000 685 # endif 686 #endif 687 688 689 #if !defined(BITS_PER_WORD) 690 # error "BITS_PER_WORD not defined" 691 #endif 692 693 #if (!NO_FLOATING) 694 695 #define S_HIDDEN_BIT_MASK MAKE_MASK(1, S_EXP_POS) 696 #define S_SIGN_BIT_MASK MAKE_MASK(1, S_SIGN_BIT_POS) 697 #define S_EXP_MASK MAKE_MASK(S_EXP_WIDTH, S_EXP_POS) 698 #define S_SIGN_EXP_MASK (S_SIGN_BIT_MASK | S_EXP_MASK) 699 #define S_MANTISSA_MASK ((~S_SIGN_EXP_MASK) & __F_TYPE_BIT_MASK) 700 #define S_MAX_BIASED_EXP (S_EXP_BIAS + S_MAX_BIN_EXP) 701 702 #define D_HIDDEN_BIT_MASK MAKE_MASK(1, D_EXP_POS) 703 #define D_SIGN_BIT_MASK MAKE_MASK(1, D_SIGN_BIT_POS) 704 #define D_EXP_MASK MAKE_MASK(D_EXP_WIDTH, D_EXP_POS) 705 #define D_SIGN_EXP_MASK (D_SIGN_BIT_MASK | D_EXP_MASK) 706 #define D_MANTISSA_MASK (~D_SIGN_EXP_MASK & __F_TYPE_BIT_MASK) 707 #define D_MAX_BIASED_EXP (D_EXP_BIAS + D_MAX_BIN_EXP) 708 709 #define Q_HIDDEN_BIT_MASK MAKE_MASK(1, Q_EXP_POS) 710 #define Q_SIGN_BIT_MASK MAKE_MASK(1, Q_SIGN_BIT_POS) 711 #define Q_EXP_MASK MAKE_MASK(Q_EXP_WIDTH, Q_EXP_POS) 712 #define Q_SIGN_EXP_MASK (Q_SIGN_BIT_MASK | Q_EXP_MASK) 713 #define Q_MANTISSA_MASK (~Q_SIGN_EXP_MASK & __F_TYPE_BIT_MASK) 714 #define Q_MAX_BIASED_EXP (Q_EXP_BIAS + Q_MAX_BIN_EXP) 715 716 717 718 /* These macros are good for creating floating constants that are 719 powers of two up to 2^M where M = (4 * BITS_PER_WORD) - 5 */ 720 721 #define __MAX_F_POW_2_EXP (4*BITS_PER_WORD - 5) 722 723 #define S1_POW_2(n) ((S_TYPE)((U_WORD)1 << (n))) 724 #define S2_POW_2(n) S1_POW_2(((n)+1)/2)*S1_POW_2((n)/2) 725 #define S4_POW_2(n) S2_POW_2(((n)+1)/2)*S2_POW_2((n)/2) 726 #define S_POW_2(n) S4_POW_2(n) 727 728 #define D1_POW_2(n) ((D_TYPE)((U_WORD)1 << (n))) 729 #define D2_POW_2(n) D1_POW_2(((n)+1)/2)*D1_POW_2((n)/2) 730 #define D4_POW_2(n) D2_POW_2(((n)+1)/2)*D2_POW_2((n)/2) 731 #define D_POW_2(n) D4_POW_2(n) 732 733 #define Q1_POW_2(n) ((Q_TYPE)((U_WORD)1 << (n))) 734 #define Q2_POW_2(n) Q1_POW_2(((n)+1)/2)*Q1_POW_2((n)/2) 735 #define Q4_POW_2(n) Q2_POW_2(((n)+1)/2)*Q2_POW_2((n)/2) 736 #define Q_POW_2(n) Q4_POW_2(n) 737 738 #define F1_POW_2(n) ((F_TYPE)((U_WORD)1 << (n))) 739 #define F2_POW_2(n) F1_POW_2(((n)+1)/2)*F1_POW_2((n)/2) 740 #define F4_POW_2(n) F2_POW_2(((n)+1)/2)*F2_POW_2((n)/2) 741 #define F_POW_2(n) F4_POW_2(n) 742 743 #define B1_POW_2(n) ((B_TYPE)((U_WORD)1 << (n))) 744 #define B2_POW_2(n) B1_POW_2(((n)+1)/2)*B1_POW_2((n)/2) 745 #define B4_POW_2(n) B2_POW_2(((n)+1)/2)*B2_POW_2((n)/2) 746 #define B_POW_2(n) B4_POW_2(n) 747 748 749 750 #if (SINGLE_PRECISION) 751 752 # define F_CHAR S_CHAR 753 # define F_TYPE S_TYPE 754 # define BITS_PER_F_TYPE BITS_PER_S_TYPE 755 # define F_NORM S_NORM 756 # define F_PRECISION S_PRECISION 757 # define F_LSB_POS S_LSB_POS 758 # define F_MSB_POS S_MSB_POS 759 # define F_EXP_POS S_EXP_POS 760 # define F_EXP_BIAS S_EXP_BIAS 761 # define F_EXP_WIDTH S_EXP_WIDTH 762 # define F_MIN_BIN_EXP S_MIN_BIN_EXP 763 # define F_MAX_BIN_EXP S_MAX_BIN_EXP 764 # define F_MIN_DEC_EXP S_MIN_DEC_EXP 765 # define F_MAX_DEC_EXP S_MAX_DEC_EXP 766 # define F_SIGN_BIT_POS S_SIGN_BIT_POS 767 # undef F_25TH_BIT_POS 768 # define F_HI_WORD S_HI_WORD 769 # define F_LO1_WORD S_LO1_WORD 770 # define F_LO2_WORD S_LO2_WORD 771 # define F_LO3_WORD S_LO3_WORD 772 # define F_LO_WORD S_LO_WORD 773 # define F_SIGNED_HI_WORD S_SIGNED_HI_WORD 774 # define F_SIGNED_HI_16 S_SIGNED_HI_16 775 # define F_SIGNED_HI_32 S_SIGNED_HI_32 776 # define F_SIGNED_HI_64 S_SIGNED_HI_64 777 # define F_SIGNED_LO1_16 S_SIGNED_LO1_16 778 # define F_SIGNED_LO1_32 S_SIGNED_LO1_32 779 # define F_SIGNED_LO1_64 S_SIGNED_LO1_64 780 # define F_SIGNED_LO2_16 S_SIGNED_LO2_16 781 # define F_SIGNED_LO2_32 S_SIGNED_LO2_32 782 # define F_SIGNED_LO2_64 S_SIGNED_LO2_64 783 # define F_SIGNED_LO3_16 S_SIGNED_LO3_16 784 # define F_SIGNED_LO3_32 S_SIGNED_LO3_32 785 # define F_SIGNED_LO3_64 S_SIGNED_LO3_64 786 # define F_SIGNED_LO_16 S_SIGNED_LO_16 787 # define F_SIGNED_LO_32 S_SIGNED_LO_32 788 # define F_SIGNED_LO_64 S_SIGNED_LO_64 789 # define F_UNSIGNED_HI_16 S_UNSIGNED_HI_16 790 # define F_UNSIGNED_HI_32 S_UNSIGNED_HI_32 791 # define F_UNSIGNED_HI_64 S_UNSIGNED_HI_64 792 # define F_UNSIGNED_LO1_16 S_UNSIGNED_LO1_16 793 # define F_UNSIGNED_LO1_32 S_UNSIGNED_LO1_32 794 # define F_UNSIGNED_LO1_64 S_UNSIGNED_LO1_64 795 # define F_UNSIGNED_LO2_16 S_UNSIGNED_LO2_16 796 # define F_UNSIGNED_LO2_32 S_UNSIGNED_LO2_32 797 # define F_UNSIGNED_LO2_64 S_UNSIGNED_LO2_64 798 # define F_UNSIGNED_LO3_16 S_UNSIGNED_LO3_16 799 # define F_UNSIGNED_LO3_32 S_UNSIGNED_LO3_32 800 # define F_UNSIGNED_LO3_64 S_UNSIGNED_LO3_64 801 # define F_UNSIGNED_LO_16 S_UNSIGNED_LO_16 802 # define F_UNSIGNED_LO_32 S_UNSIGNED_LO_32 803 # define F_UNSIGNED_LO_64 S_UNSIGNED_LO_64 804 # define F_UNION S_UNION 805 # define F_COMPLEX S_COMPLEX 806 # define F_HIDDEN_BIT_MASK S_HIDDEN_BIT_MASK 807 # define F_SIGN_BIT_MASK S_SIGN_BIT_MASK 808 # define F_EXP_MASK S_EXP_MASK 809 # define F_SIGN_EXP_MASK S_SIGN_EXP_MASK 810 # define F_MANTISSA_MASK S_MANTISSA_MASK 811 # define F_MAX_BIASED_EXP S_MAX_BIASED_EXP 812 813 # define B_FORMAT D_FORMAT 814 # define B_CHAR D_CHAR 815 # define B_TYPE D_TYPE 816 # define BITS_PER_B_TYPE BITS_PER_D_TYPE 817 # define B_NORM D_NORM 818 # define B_PRECISION D_PRECISION 819 # define B_LSB_POS D_LSB_POS 820 # define B_MSB_POS D_MSB_POS 821 # define B_EXP_POS D_EXP_POS 822 # define B_EXP_BIAS D_EXP_BIAS 823 # define B_EXP_WIDTH D_EXP_WIDTH 824 # define B_MIN_BIN_EXP D_MIN_BIN_EXP 825 # define B_MAX_BIN_EXP D_MAX_BIN_EXP 826 # define B_MIN_DEC_EXP D_MIN_DEC_EXP 827 # define B_MAX_DEC_EXP D_MAX_DEC_EXP 828 # define B_SIGN_BIT_POS D_SIGN_BIT_POS 829 # define B_25TH_BIT_POS D_25TH_BIT_POS 830 # define B_HI_WORD D_HI_WORD 831 # define B_LO1_WORD D_LO1_WORD 832 # define B_LO2_WORD D_LO2_WORD 833 # define B_LO3_WORD D_LO3_WORD 834 # define B_LO_WORD D_LO_WORD 835 # define B_SIGNED_HI_WORD D_SIGNED_HI_WORD 836 # define B_SIGNED_HI_16 D_SIGNED_HI_16 837 # define B_SIGNED_HI_32 D_SIGNED_HI_32 838 # define B_SIGNED_HI_64 D_SIGNED_HI_64 839 # define B_SIGNED_LO1_16 D_SIGNED_LO1_16 840 # define B_SIGNED_LO1_32 D_SIGNED_LO1_32 841 # define B_SIGNED_LO1_64 D_SIGNED_LO1_64 842 # define B_SIGNED_LO2_16 D_SIGNED_LO2_16 843 # define B_SIGNED_LO2_32 D_SIGNED_LO2_32 844 # define B_SIGNED_LO2_64 D_SIGNED_LO2_64 845 # define B_SIGNED_LO3_16 D_SIGNED_LO3_16 846 # define B_SIGNED_LO3_32 D_SIGNED_LO3_32 847 # define B_SIGNED_LO3_64 D_SIGNED_LO3_64 848 # define B_SIGNED_LO_16 D_SIGNED_LO_16 849 # define B_SIGNED_LO_32 D_SIGNED_LO_32 850 # define B_SIGNED_LO_64 D_SIGNED_LO_64 851 # define B_UNSIGNED_HI_16 D_UNSIGNED_HI_16 852 # define B_UNSIGNED_HI_32 D_UNSIGNED_HI_32 853 # define B_UNSIGNED_HI_64 D_UNSIGNED_HI_64 854 # define B_UNSIGNED_LO1_16 D_UNSIGNED_LO1_16 855 # define B_UNSIGNED_LO1_32 D_UNSIGNED_LO1_32 856 # define B_UNSIGNED_LO1_64 D_UNSIGNED_LO1_64 857 # define B_UNSIGNED_LO2_16 D_UNSIGNED_LO2_16 858 # define B_UNSIGNED_LO2_32 D_UNSIGNED_LO2_32 859 # define B_UNSIGNED_LO2_64 D_UNSIGNED_LO2_64 860 # define B_UNSIGNED_LO3_16 D_UNSIGNED_LO3_16 861 # define B_UNSIGNED_LO3_32 D_UNSIGNED_LO3_32 862 # define B_UNSIGNED_LO3_64 D_UNSIGNED_LO3_64 863 # define B_UNSIGNED_LO_16 D_UNSIGNED_LO_16 864 # define B_UNSIGNED_LO_32 D_UNSIGNED_LO_32 865 # define B_UNSIGNED_LO_64 D_UNSIGNED_LO_64 866 # define B_UNION D_UNION 867 # define B_COMPLEX D_COMPLEX 868 # define B_HIDDEN_BIT_MASK D_HIDDEN_BIT_MASK 869 # define B_SIGN_BIT_MASK D_SIGN_BIT_MASK 870 # define B_EXP_MASK D_EXP_MASK 871 # define B_SIGN_EXP_MASK D_SIGN_EXP_MASK 872 # define B_MANTISSA_MASK D_MANTISSA_MASK 873 # define B_MAX_BIASED_EXP D_MAX_BIASED_EXP 874 875 # define B_SET_25TH_BIT(x) { \ 876 B_UNION u; \ 877 u.f = (x); \ 878 u.B_LO_WORD |= ((U_WORD)1 << B_25TH_BIT_POS); \ 879 (x) = u.f; \ 880 } 881 882 # define B_CLEAR_25TH_BIT(x) { \ 883 B_UNION u; \ 884 u.f = (x); \ 885 u.B_LO_WORD &= ~((U_WORD)1 << B_25TH_BIT_POS); \ 886 (x) = u.f; \ 887 } 888 889 # define R_FORMAT S_FORMAT 890 # define R_CHAR S_CHAR 891 # define R_TYPE S_TYPE 892 # define BITS_PER_R_TYPE BITS_PER_S_TYPE 893 # define R_NORM S_NORM 894 # define R_PRECISION S_PRECISION 895 # define R_LSB_POS S_LSB_POS 896 # define R_MSB_POS S_MSB_POS 897 # define R_EXP_POS S_EXP_POS 898 # define R_EXP_BIAS S_EXP_BIAS 899 # define R_EXP_WIDTH S_EXP_WIDTH 900 # define R_MIN_BIN_EXP S_MIN_BIN_EXP 901 # define R_MAX_BIN_EXP S_MAX_BIN_EXP 902 # define R_MIN_DEC_EXP S_MIN_DEC_EXP 903 # define R_MAX_DEC_EXP S_MAX_DEC_EXP 904 # define R_SIGN_BIT_POS S_SIGN_BIT_POS 905 # define R_25TH_BIT_POS S_25TH_BIT_POS 906 # define R_HI_WORD S_HI_WORD 907 # define R_LO1_WORD S_LO1_WORD 908 # define R_LO2_WORD S_LO2_WORD 909 # define R_LO3_WORD S_LO3_WORD 910 # define R_LO_WORD S_LO_WORD 911 # define R_SIGNED_HI_WORD S_SIGNED_HI_WORD 912 # define R_SIGNED_HI_16 S_SIGNED_HI_16 913 # define R_SIGNED_HI_32 S_SIGNED_HI_32 914 # define R_SIGNED_HI_64 S_SIGNED_HI_64 915 # define R_SIGNED_LO1_16 S_SIGNED_LO1_16 916 # define R_SIGNED_LO1_32 S_SIGNED_LO1_32 917 # define R_SIGNED_LO1_64 S_SIGNED_LO1_64 918 # define R_SIGNED_LO2_16 S_SIGNED_LO2_16 919 # define R_SIGNED_LO2_32 S_SIGNED_LO2_32 920 # define R_SIGNED_LO2_64 S_SIGNED_LO2_64 921 # define R_SIGNED_LO3_16 S_SIGNED_LO3_16 922 # define R_SIGNED_LO3_32 S_SIGNED_LO3_32 923 # define R_SIGNED_LO3_64 S_SIGNED_LO3_64 924 # define R_SIGNED_LO_16 S_SIGNED_LO_16 925 # define R_SIGNED_LO_32 S_SIGNED_LO_32 926 # define R_SIGNED_LO_64 S_SIGNED_LO_64 927 # define R_UNSIGNED_HI_16 S_UNSIGNED_HI_16 928 # define R_UNSIGNED_HI_32 S_UNSIGNED_HI_32 929 # define R_UNSIGNED_HI_64 S_UNSIGNED_HI_64 930 # define R_UNSIGNED_LO1_16 S_UNSIGNED_LO1_16 931 # define R_UNSIGNED_LO1_32 S_UNSIGNED_LO1_32 932 # define R_UNSIGNED_LO1_64 S_UNSIGNED_LO1_64 933 # define R_UNSIGNED_LO2_16 S_UNSIGNED_LO2_16 934 # define R_UNSIGNED_LO2_32 S_UNSIGNED_LO2_32 935 # define R_UNSIGNED_LO2_64 S_UNSIGNED_LO2_64 936 # define R_UNSIGNED_LO3_16 S_UNSIGNED_LO3_16 937 # define R_UNSIGNED_LO3_32 S_UNSIGNED_LO3_32 938 # define R_UNSIGNED_LO3_64 S_UNSIGNED_LO3_64 939 # define R_UNSIGNED_LO_16 S_UNSIGNED_LO_16 940 # define R_UNSIGNED_LO_32 S_UNSIGNED_LO_32 941 # define R_UNSIGNED_LO_64 S_UNSIGNED_LO_64 942 # define R_UNION S_UNION 943 # define R_COMPLEX S_COMPLEX 944 # define R_HIDDEN_BIT_MASK S_HIDDEN_BIT_MASK 945 # define R_SIGN_BIT_MASK S_SIGN_BIT_MASK 946 # define R_EXP_MASK S_EXP_MASK 947 # define R_SIGN_EXP_MASK S_SIGN_EXP_MASK 948 # define R_MANTISSA_MASK S_MANTISSA_MASK 949 # define R_MAX_BIASED_EXP S_MAX_BIASED_EXP 950 951 #elif (DOUBLE_PRECISION) 952 953 954 # define F_CHAR D_CHAR 955 # define F_TYPE D_TYPE 956 # define BITS_PER_F_TYPE BITS_PER_D_TYPE 957 # define F_NORM D_NORM 958 # define F_PRECISION D_PRECISION 959 # define F_LSB_POS D_LSB_POS 960 # define F_MSB_POS D_MSB_POS 961 # define F_EXP_POS D_EXP_POS 962 # define F_EXP_BIAS D_EXP_BIAS 963 # define F_EXP_WIDTH D_EXP_WIDTH 964 # define F_MIN_BIN_EXP D_MIN_BIN_EXP 965 # define F_MAX_BIN_EXP D_MAX_BIN_EXP 966 # define F_MIN_DEC_EXP D_MIN_DEC_EXP 967 # define F_MAX_DEC_EXP D_MAX_DEC_EXP 968 # define F_SIGN_BIT_POS D_SIGN_BIT_POS 969 # define F_25TH_BIT_POS D_25TH_BIT_POS 970 # define F_HI_WORD D_HI_WORD 971 # define F_LO1_WORD D_LO1_WORD 972 # define F_LO2_WORD D_LO2_WORD 973 # define F_LO3_WORD D_LO3_WORD 974 # define F_LO_WORD D_LO_WORD 975 # define F_SIGNED_HI_WORD D_SIGNED_HI_WORD 976 # define F_SIGNED_HI_16 D_SIGNED_HI_16 977 # define F_SIGNED_HI_32 D_SIGNED_HI_32 978 # define F_SIGNED_HI_64 D_SIGNED_HI_64 979 # define F_SIGNED_LO1_16 D_SIGNED_LO1_16 980 # define F_SIGNED_LO1_32 D_SIGNED_LO1_32 981 # define F_SIGNED_LO1_64 D_SIGNED_LO1_64 982 # define F_SIGNED_LO2_16 D_SIGNED_LO2_16 983 # define F_SIGNED_LO2_32 D_SIGNED_LO2_32 984 # define F_SIGNED_LO2_64 D_SIGNED_LO2_64 985 # define F_SIGNED_LO3_16 D_SIGNED_LO3_16 986 # define F_SIGNED_LO3_32 D_SIGNED_LO3_32 987 # define F_SIGNED_LO3_64 D_SIGNED_LO3_64 988 # define F_SIGNED_LO_16 D_SIGNED_LO_16 989 # define F_SIGNED_LO_32 D_SIGNED_LO_32 990 # define F_SIGNED_LO_64 D_SIGNED_LO_64 991 # define F_UNSIGNED_HI_16 D_UNSIGNED_HI_16 992 # define F_UNSIGNED_HI_32 D_UNSIGNED_HI_32 993 # define F_UNSIGNED_HI_64 D_UNSIGNED_HI_64 994 # define F_UNSIGNED_LO1_16 D_UNSIGNED_LO1_16 995 # define F_UNSIGNED_LO1_32 D_UNSIGNED_LO1_32 996 # define F_UNSIGNED_LO1_64 D_UNSIGNED_LO1_64 997 # define F_UNSIGNED_LO2_16 D_UNSIGNED_LO2_16 998 # define F_UNSIGNED_LO2_32 D_UNSIGNED_LO2_32 999 # define F_UNSIGNED_LO2_64 D_UNSIGNED_LO2_64 1000 # define F_UNSIGNED_LO3_16 D_UNSIGNED_LO3_16 1001 # define F_UNSIGNED_LO3_32 D_UNSIGNED_LO3_32 1002 # define F_UNSIGNED_LO3_64 D_UNSIGNED_LO3_64 1003 # define F_UNSIGNED_LO_16 D_UNSIGNED_LO_16 1004 # define F_UNSIGNED_LO_32 D_UNSIGNED_LO_32 1005 # define F_UNSIGNED_LO_64 D_UNSIGNED_LO_64 1006 # define F_UNION D_UNION 1007 # define F_COMPLEX D_COMPLEX 1008 # define F_HIDDEN_BIT_MASK D_HIDDEN_BIT_MASK 1009 # define F_SIGN_BIT_MASK D_SIGN_BIT_MASK 1010 # define F_EXP_MASK D_EXP_MASK 1011 # define F_SIGN_EXP_MASK D_SIGN_EXP_MASK 1012 # define F_MANTISSA_MASK D_MANTISSA_MASK 1013 # define F_MAX_BIASED_EXP D_MAX_BIASED_EXP 1014 1015 # define B_CHAR D_CHAR 1016 # define B_TYPE D_TYPE 1017 # define BITS_PER_B_TYPE BITS_PER_D_TYPE 1018 # define B_NORM D_NORM 1019 # define B_PRECISION D_PRECISION 1020 # define B_LSB_POS D_LSB_POS 1021 # define B_MSB_POS D_MSB_POS 1022 # define B_EXP_POS D_EXP_POS 1023 # define B_EXP_BIAS D_EXP_BIAS 1024 # define B_EXP_WIDTH D_EXP_WIDTH 1025 # define B_MIN_BIN_EXP D_MIN_BIN_EXP 1026 # define B_MAX_BIN_EXP D_MAX_BIN_EXP 1027 # define B_MIN_DEC_EXP D_MIN_DEC_EXP 1028 # define B_MAX_DEC_EXP D_MAX_DEC_EXP 1029 # define B_SIGN_BIT_POS D_SIGN_BIT_POS 1030 # define B_25TH_BIT_POS D_25TH_BIT_POS 1031 # define B_HI_WORD D_HI_WORD 1032 # define B_LO1_WORD D_LO1_WORD 1033 # define B_LO2_WORD D_LO2_WORD 1034 # define B_LO3_WORD D_LO3_WORD 1035 # define B_LO_WORD D_LO_WORD 1036 # define B_SIGNED_HI_WORD D_SIGNED_HI_WORD 1037 # define B_SIGNED_HI_16 D_SIGNED_HI_16 1038 # define B_SIGNED_HI_32 D_SIGNED_HI_32 1039 # define B_SIGNED_HI_64 D_SIGNED_HI_64 1040 # define B_SIGNED_LO1_16 D_SIGNED_LO1_16 1041 # define B_SIGNED_LO1_32 D_SIGNED_LO1_32 1042 # define B_SIGNED_LO1_64 D_SIGNED_LO1_64 1043 # define B_SIGNED_LO2_16 D_SIGNED_LO2_16 1044 # define B_SIGNED_LO2_32 D_SIGNED_LO2_32 1045 # define B_SIGNED_LO2_64 D_SIGNED_LO2_64 1046 # define B_SIGNED_LO3_16 D_SIGNED_LO3_16 1047 # define B_SIGNED_LO3_32 D_SIGNED_LO3_32 1048 # define B_SIGNED_LO3_64 D_SIGNED_LO3_64 1049 # define B_SIGNED_LO_16 D_SIGNED_LO_16 1050 # define B_SIGNED_LO_32 D_SIGNED_LO_32 1051 # define B_SIGNED_LO_64 D_SIGNED_LO_64 1052 # define B_UNSIGNED_HI_16 D_UNSIGNED_HI_16 1053 # define B_UNSIGNED_HI_32 D_UNSIGNED_HI_32 1054 # define B_UNSIGNED_HI_64 D_UNSIGNED_HI_64 1055 # define B_UNSIGNED_LO1_16 D_UNSIGNED_LO1_16 1056 # define B_UNSIGNED_LO1_32 D_UNSIGNED_LO1_32 1057 # define B_UNSIGNED_LO1_64 D_UNSIGNED_LO1_64 1058 # define B_UNSIGNED_LO2_16 D_UNSIGNED_LO2_16 1059 # define B_UNSIGNED_LO2_32 D_UNSIGNED_LO2_32 1060 # define B_UNSIGNED_LO2_64 D_UNSIGNED_LO2_64 1061 # define B_UNSIGNED_LO3_16 D_UNSIGNED_LO3_16 1062 # define B_UNSIGNED_LO3_32 D_UNSIGNED_LO3_32 1063 # define B_UNSIGNED_LO3_64 D_UNSIGNED_LO3_64 1064 # define B_UNSIGNED_LO_16 D_UNSIGNED_LO_16 1065 # define B_UNSIGNED_LO_32 D_UNSIGNED_LO_32 1066 # define B_UNSIGNED_LO_64 D_UNSIGNED_LO_64 1067 # define B_UNION D_UNION 1068 # define B_COMPLEX D_COMPLEX 1069 # define B_HIDDEN_BIT_MASK D_HIDDEN_BIT_MASK 1070 # define B_SIGN_BIT_MASK D_SIGN_BIT_MASK 1071 # define B_EXP_MASK D_EXP_MASK 1072 # define B_SIGN_EXP_MASK D_SIGN_EXP_MASK 1073 # define B_MANTISSA_MASK D_MANTISSA_MASK 1074 # define B_MAX_BIASED_EXP D_MAX_BIASED_EXP 1075 1076 1077 # define R_FORMAT S_FORMAT 1078 # define R_CHAR S_CHAR 1079 # define R_TYPE S_TYPE 1080 # define BITS_PER_R_TYPE BITS_PER_S_TYPE 1081 # define R_NORM S_NORM 1082 # define R_PRECISION S_PRECISION 1083 # define R_LSB_POS S_LSB_POS 1084 # define R_MSB_POS S_MSB_POS 1085 # define R_EXP_POS S_EXP_POS 1086 # define R_EXP_BIAS S_EXP_BIAS 1087 # define R_EXP_WIDTH S_EXP_WIDTH 1088 # define R_MIN_BIN_EXP S_MIN_BIN_EXP 1089 # define R_MAX_BIN_EXP S_MAX_BIN_EXP 1090 # define R_MIN_DEC_EXP S_MIN_DEC_EXP 1091 # define R_MAX_DEC_EXP S_MAX_DEC_EXP 1092 # define R_SIGN_BIT_POS S_SIGN_BIT_POS 1093 # define R_25TH_BIT_POS S_25TH_BIT_POS 1094 # define R_HI_WORD S_HI_WORD 1095 # define R_LO1_WORD S_LO1_WORD 1096 # define R_LO2_WORD S_LO2_WORD 1097 # define R_LO3_WORD S_LO3_WORD 1098 # define R_LO_WORD S_LO_WORD 1099 # define R_SIGNED_HI_WORD S_SIGNED_HI_WORD 1100 # define R_SIGNED_HI_16 S_SIGNED_HI_16 1101 # define R_SIGNED_HI_32 S_SIGNED_HI_32 1102 # define R_SIGNED_HI_64 S_SIGNED_HI_64 1103 # define R_SIGNED_LO1_16 S_SIGNED_LO1_16 1104 # define R_SIGNED_LO1_32 S_SIGNED_LO1_32 1105 # define R_SIGNED_LO1_64 S_SIGNED_LO1_64 1106 # define R_SIGNED_LO2_16 S_SIGNED_LO2_16 1107 # define R_SIGNED_LO2_32 S_SIGNED_LO2_32 1108 # define R_SIGNED_LO2_64 S_SIGNED_LO2_64 1109 # define R_SIGNED_LO3_16 S_SIGNED_LO3_16 1110 # define R_SIGNED_LO3_32 S_SIGNED_LO3_32 1111 # define R_SIGNED_LO3_64 S_SIGNED_LO3_64 1112 # define R_SIGNED_LO_16 S_SIGNED_LO_16 1113 # define R_SIGNED_LO_32 S_SIGNED_LO_32 1114 # define R_SIGNED_LO_64 S_SIGNED_LO_64 1115 # define R_UNSIGNED_HI_16 S_UNSIGNED_HI_16 1116 # define R_UNSIGNED_HI_32 S_UNSIGNED_HI_32 1117 # define R_UNSIGNED_HI_64 S_UNSIGNED_HI_64 1118 # define R_UNSIGNED_LO1_16 S_UNSIGNED_LO1_16 1119 # define R_UNSIGNED_LO1_32 S_UNSIGNED_LO1_32 1120 # define R_UNSIGNED_LO1_64 S_UNSIGNED_LO1_64 1121 # define R_UNSIGNED_LO2_16 S_UNSIGNED_LO2_16 1122 # define R_UNSIGNED_LO2_32 S_UNSIGNED_LO2_32 1123 # define R_UNSIGNED_LO2_64 S_UNSIGNED_LO2_64 1124 # define R_UNSIGNED_LO3_16 S_UNSIGNED_LO3_16 1125 # define R_UNSIGNED_LO3_32 S_UNSIGNED_LO3_32 1126 # define R_UNSIGNED_LO3_64 S_UNSIGNED_LO3_64 1127 # define R_UNSIGNED_LO_16 S_UNSIGNED_LO_16 1128 # define R_UNSIGNED_LO_32 S_UNSIGNED_LO_32 1129 # define R_UNSIGNED_LO_64 S_UNSIGNED_LO_64 1130 # define R_UNION S_UNION 1131 # define R_COMPLEX S_COMPLEX 1132 # define R_HIDDEN_BIT_MASK S_HIDDEN_BIT_MASK 1133 # define R_SIGN_BIT_MASK S_SIGN_BIT_MASK 1134 # define R_EXP_MASK S_EXP_MASK 1135 # define R_SIGN_EXP_MASK S_SIGN_EXP_MASK 1136 # define R_MANTISSA_MASK S_MANTISSA_MASK 1137 # define R_MAX_BIASED_EXP S_MAX_BIASED_EXP 1138 1139 1140 #elif (QUAD_PRECISION) 1141 1142 1143 # define F_CHAR Q_CHAR 1144 # define F_TYPE Q_TYPE 1145 # define BITS_PER_F_TYPE BITS_PER_Q_TYPE 1146 # define F_NORM Q_NORM 1147 # define F_PRECISION Q_PRECISION 1148 # define F_LSB_POS Q_LSB_POS 1149 # define F_MSB_POS Q_MSB_POS 1150 # define F_EXP_POS Q_EXP_POS 1151 # define F_EXP_BIAS Q_EXP_BIAS 1152 # define F_EXP_WIDTH Q_EXP_WIDTH 1153 # define F_MIN_BIN_EXP Q_MIN_BIN_EXP 1154 # define F_MAX_BIN_EXP Q_MAX_BIN_EXP 1155 # define F_MIN_DEC_EXP Q_MIN_DEC_EXP 1156 # define F_MAX_DEC_EXP Q_MAX_DEC_EXP 1157 # define F_SIGN_BIT_POS Q_SIGN_BIT_POS 1158 # define F_25TH_BIT_POS Q_25TH_BIT_POS 1159 # define F_HI_WORD Q_HI_WORD 1160 # define F_LO1_WORD Q_LO1_WORD 1161 # define F_LO2_WORD Q_LO2_WORD 1162 # define F_LO3_WORD Q_LO3_WORD 1163 # define F_LO_WORD Q_LO_WORD 1164 # define F_SIGNED_HI_WORD Q_SIGNED_HI_WORD 1165 # define F_SIGNED_HI_16 Q_SIGNED_HI_16 1166 # define F_SIGNED_HI_32 Q_SIGNED_HI_32 1167 # define F_SIGNED_HI_64 Q_SIGNED_HI_64 1168 # define F_SIGNED_LO1_16 Q_SIGNED_LO1_16 1169 # define F_SIGNED_LO1_32 Q_SIGNED_LO1_32 1170 # define F_SIGNED_LO1_64 Q_SIGNED_LO1_64 1171 # define F_SIGNED_LO2_16 Q_SIGNED_LO2_16 1172 # define F_SIGNED_LO2_32 Q_SIGNED_LO2_32 1173 # define F_SIGNED_LO2_64 Q_SIGNED_LO2_64 1174 # define F_SIGNED_LO3_16 Q_SIGNED_LO3_16 1175 # define F_SIGNED_LO3_32 Q_SIGNED_LO3_32 1176 # define F_SIGNED_LO3_64 Q_SIGNED_LO3_64 1177 # define F_SIGNED_LO_16 Q_SIGNED_LO_16 1178 # define F_SIGNED_LO_32 Q_SIGNED_LO_32 1179 # define F_SIGNED_LO_64 Q_SIGNED_LO_64 1180 # define F_UNSIGNED_HI_16 Q_UNSIGNED_HI_16 1181 # define F_UNSIGNED_HI_32 Q_UNSIGNED_HI_32 1182 # define F_UNSIGNED_HI_64 Q_UNSIGNED_HI_64 1183 # define F_UNSIGNED_LO1_16 Q_UNSIGNED_LO1_16 1184 # define F_UNSIGNED_LO1_32 Q_UNSIGNED_LO1_32 1185 # define F_UNSIGNED_LO1_64 Q_UNSIGNED_LO1_64 1186 # define F_UNSIGNED_LO2_16 Q_UNSIGNED_LO2_16 1187 # define F_UNSIGNED_LO2_32 Q_UNSIGNED_LO2_32 1188 # define F_UNSIGNED_LO2_64 Q_UNSIGNED_LO2_64 1189 # define F_UNSIGNED_LO3_16 Q_UNSIGNED_LO3_16 1190 # define F_UNSIGNED_LO3_32 Q_UNSIGNED_LO3_32 1191 # define F_UNSIGNED_LO3_64 Q_UNSIGNED_LO3_64 1192 # define F_UNSIGNED_LO_16 Q_UNSIGNED_LO_16 1193 # define F_UNSIGNED_LO_32 Q_UNSIGNED_LO_32 1194 # define F_UNSIGNED_LO_64 Q_UNSIGNED_LO_64 1195 # define F_UNION Q_UNION 1196 # define F_COMPLEX Q_COMPLEX 1197 # define F_HIDDEN_BIT_MASK Q_HIDDEN_BIT_MASK 1198 # define F_SIGN_BIT_MASK Q_SIGN_BIT_MASK 1199 # define F_EXP_MASK Q_EXP_MASK 1200 # define F_SIGN_EXP_MASK Q_SIGN_EXP_MASK 1201 # define F_MANTISSA_MASK Q_MANTISSA_MASK 1202 # define F_MAX_BIASED_EXP Q_MAX_BIASED_EXP 1203 1204 # define B_CHAR Q_CHAR 1205 # define B_TYPE Q_TYPE 1206 # define BITS_PER_B_TYPE BITS_PER_Q_TYPE 1207 # define B_NORM Q_NORM 1208 # define B_PRECISION Q_PRECISION 1209 # define B_LSB_POS Q_LSB_POS 1210 # define B_MSB_POS Q_MSB_POS 1211 # define B_EXP_POS Q_EXP_POS 1212 # define B_EXP_BIAS Q_EXP_BIAS 1213 # define B_EXP_WIDTH Q_EXP_WIDTH 1214 # define B_MIN_BIN_EXP Q_MIN_BIN_EXP 1215 # define B_MAX_BIN_EXP Q_MAX_BIN_EXP 1216 # define B_MIN_DEC_EXP Q_MIN_DEC_EXP 1217 # define B_MAX_DEC_EXP Q_MAX_DEC_EXP 1218 # define B_SIGN_BIT_POS Q_SIGN_BIT_POS 1219 # define B_25TH_BIT_POS Q_25TH_BIT_POS 1220 # define B_HI_WORD Q_HI_WORD 1221 # define B_LO1_WORD Q_LO1_WORD 1222 # define B_LO2_WORD Q_LO2_WORD 1223 # define B_LO3_WORD Q_LO3_WORD 1224 # define B_LO_WORD Q_LO_WORD 1225 # define B_SIGNED_HI_WORD Q_SIGNED_HI_WORD 1226 # define B_SIGNED_HI_16 Q_SIGNED_HI_16 1227 # define B_SIGNED_HI_32 Q_SIGNED_HI_32 1228 # define B_SIGNED_HI_64 Q_SIGNED_HI_64 1229 # define B_SIGNED_LO1_16 Q_SIGNED_LO1_16 1230 # define B_SIGNED_LO1_32 Q_SIGNED_LO1_32 1231 # define B_SIGNED_LO1_64 Q_SIGNED_LO1_64 1232 # define B_SIGNED_LO2_16 Q_SIGNED_LO2_16 1233 # define B_SIGNED_LO2_32 Q_SIGNED_LO2_32 1234 # define B_SIGNED_LO2_64 Q_SIGNED_LO2_64 1235 # define B_SIGNED_LO3_16 Q_SIGNED_LO3_16 1236 # define B_SIGNED_LO3_32 Q_SIGNED_LO3_32 1237 # define B_SIGNED_LO3_64 Q_SIGNED_LO3_64 1238 # define B_SIGNED_LO_16 Q_SIGNED_LO_16 1239 # define B_SIGNED_LO_32 Q_SIGNED_LO_32 1240 # define B_SIGNED_LO_64 Q_SIGNED_LO_64 1241 # define B_UNSIGNED_HI_16 Q_UNSIGNED_HI_16 1242 # define B_UNSIGNED_HI_32 Q_UNSIGNED_HI_32 1243 # define B_UNSIGNED_HI_64 Q_UNSIGNED_HI_64 1244 # define B_UNSIGNED_LO1_16 Q_UNSIGNED_LO1_16 1245 # define B_UNSIGNED_LO1_32 Q_UNSIGNED_LO1_32 1246 # define B_UNSIGNED_LO1_64 Q_UNSIGNED_LO1_64 1247 # define B_UNSIGNED_LO2_16 Q_UNSIGNED_LO2_16 1248 # define B_UNSIGNED_LO2_32 Q_UNSIGNED_LO2_32 1249 # define B_UNSIGNED_LO2_64 Q_UNSIGNED_LO2_64 1250 # define B_UNSIGNED_LO3_16 Q_UNSIGNED_LO3_16 1251 # define B_UNSIGNED_LO3_32 Q_UNSIGNED_LO3_32 1252 # define B_UNSIGNED_LO3_64 Q_UNSIGNED_LO3_64 1253 # define B_UNSIGNED_LO_16 Q_UNSIGNED_LO_16 1254 # define B_UNSIGNED_LO_32 Q_UNSIGNED_LO_32 1255 # define B_UNSIGNED_LO_64 Q_UNSIGNED_LO_64 1256 # define B_UNION Q_UNION 1257 # define B_COMPLEX Q_COMPLEX 1258 # define B_HIDDEN_BIT_MASK Q_HIDDEN_BIT_MASK 1259 # define B_SIGN_BIT_MASK Q_SIGN_BIT_MASK 1260 # define B_EXP_MASK Q_EXP_MASK 1261 # define B_SIGN_EXP_MASK Q_SIGN_EXP_MASK 1262 # define B_MANTISSA_MASK Q_MANTISSA_MASK 1263 # define B_MAX_BIASED_EXP Q_MAX_BIASED_EXP 1264 1265 1266 # define R_FORMAT D_FORMAT 1267 # define R_CHAR D_CHAR 1268 # define R_TYPE D_TYPE 1269 # define BITS_PER_R_TYPE BITS_PER_D_TYPE 1270 # define R_NORM D_NORM 1271 # define R_PRECISION D_PRECISION 1272 # define R_LSB_POS D_LSB_POS 1273 # define R_MSB_POS D_MSB_POS 1274 # define R_EXP_POS D_EXP_POS 1275 # define R_EXP_BIAS D_EXP_BIAS 1276 # define R_EXP_WIDTH D_EXP_WIDTH 1277 # define R_MIN_BIN_EXP D_MIN_BIN_EXP 1278 # define R_MAX_BIN_EXP D_MAX_BIN_EXP 1279 # define R_MIN_DEC_EXP D_MIN_DEC_EXP 1280 # define R_MAX_DEC_EXP D_MAX_DEC_EXP 1281 # define R_SIGN_BIT_POS D_SIGN_BIT_POS 1282 # define R_25TH_BIT_POS D_25TH_BIT_POS 1283 # define R_HI_WORD D_HI_WORD 1284 # define R_LO1_WORD D_LO1_WORD 1285 # define R_LO2_WORD D_LO2_WORD 1286 # define R_LO3_WORD D_LO3_WORD 1287 # define R_LO_WORD D_LO_WORD 1288 # define R_SIGNED_HI_WORD D_SIGNED_HI_WORD 1289 # define R_SIGNED_HI_16 D_SIGNED_HI_16 1290 # define R_SIGNED_HI_32 D_SIGNED_HI_32 1291 # define R_SIGNED_HI_64 D_SIGNED_HI_64 1292 # define R_SIGNED_LO1_16 D_SIGNED_LO1_16 1293 # define R_SIGNED_LO1_32 D_SIGNED_LO1_32 1294 # define R_SIGNED_LO1_64 D_SIGNED_LO1_64 1295 # define R_SIGNED_LO2_16 D_SIGNED_LO2_16 1296 # define R_SIGNED_LO2_32 D_SIGNED_LO2_32 1297 # define R_SIGNED_LO2_64 D_SIGNED_LO2_64 1298 # define R_SIGNED_LO3_16 D_SIGNED_LO3_16 1299 # define R_SIGNED_LO3_32 D_SIGNED_LO3_32 1300 # define R_SIGNED_LO3_64 D_SIGNED_LO3_64 1301 # define R_SIGNED_LO_16 D_SIGNED_LO_16 1302 # define R_SIGNED_LO_32 D_SIGNED_LO_32 1303 # define R_SIGNED_LO_64 D_SIGNED_LO_64 1304 # define R_UNSIGNED_HI_16 D_UNSIGNED_HI_16 1305 # define R_UNSIGNED_HI_32 D_UNSIGNED_HI_32 1306 # define R_UNSIGNED_HI_64 D_UNSIGNED_HI_64 1307 # define R_UNSIGNED_LO1_16 D_UNSIGNED_LO1_16 1308 # define R_UNSIGNED_LO1_32 D_UNSIGNED_LO1_32 1309 # define R_UNSIGNED_LO1_64 D_UNSIGNED_LO1_64 1310 # define R_UNSIGNED_LO2_16 D_UNSIGNED_LO2_16 1311 # define R_UNSIGNED_LO2_32 D_UNSIGNED_LO2_32 1312 # define R_UNSIGNED_LO2_64 D_UNSIGNED_LO2_64 1313 # define R_UNSIGNED_LO3_16 D_UNSIGNED_LO3_16 1314 # define R_UNSIGNED_LO3_32 D_UNSIGNED_LO3_32 1315 # define R_UNSIGNED_LO3_64 D_UNSIGNED_LO3_64 1316 # define R_UNSIGNED_LO_16 D_UNSIGNED_LO_16 1317 # define R_UNSIGNED_LO_32 D_UNSIGNED_LO_32 1318 # define R_UNSIGNED_LO_64 D_UNSIGNED_LO_64 1319 # define R_UNION D_UNION 1320 # define R_COMPLEX D_COMPLEX 1321 # define R_HIDDEN_BIT_MASK D_HIDDEN_BIT_MASK 1322 # define R_SIGN_BIT_MASK D_SIGN_BIT_MASK 1323 # define R_EXP_MASK D_EXP_MASK 1324 # define R_SIGN_EXP_MASK D_SIGN_EXP_MASK 1325 # define R_MANTISSA_MASK D_MANTISSA_MASK 1326 # define R_MAX_BIASED_EXP D_MAX_BIASED_EXP 1327 1328 1329 #else 1330 1331 # error Unrecognized floating precision. 1332 1333 #endif 1334 1335 /* Fix up for x_MANTISSA_MASK */ 1336 #if BITS_PER_WORD > BITS_PER_F_TYPE 1337 # define __F_TYPE_BIT_MASK MAKE_MASK(BITS_PER_F_TYPE, 0) 1338 #else 1339 # define __F_TYPE_BIT_MASK ((U_WORD) (-1)) 1340 #endif 1341 1342 1343 #undef RANGE_BACKUP_AVAILABLE 1344 #if (defined(B_FORMAT) \ 1345 && defined(B_TYPE) \ 1346 && (B_PRECISION >= F_PRECISION) \ 1347 && (B_EXP_WIDTH >= F_EXP_WIDTH + 1)) 1348 # define RANGE_BACKUP_AVAILABLE 1 1349 #endif 1350 1351 #undef PRECISION_BACKUP_AVAILABLE 1352 #if (defined(B_FORMAT) \ 1353 && defined(B_TYPE) \ 1354 && (B_EXP_WIDTH >= F_EXP_WIDTH) \ 1355 && (B_PRECISION >= F_PRECISION * 2)) 1356 # define PRECISION_BACKUP_AVAILABLE 1 1357 #endif 1358 1359 1360 #define HI(a) PASTE(a,_hi) 1361 #define LO(a) PASTE(a,_lo) 1362 1363 1364 #if (PRECISION_BACKUP_AVAILABLE) 1365 # define DECLARE_PREC_BACKUP(x) B_TYPE x 1366 #else 1367 # define DECLARE_PREC_BACKUP(x) F_TYPE HI(x), LO(x) 1368 #endif 1369 1370 #if USE_BACKUP 1371 # define USE_BACKUP 1 1372 #elif !defined(USE_BACKUP)&& RANGE_BACKUP_AVAILABLE &&PRECISION_BACKUP_AVAILABLE 1373 # define USE_BACKUP 1 1374 #else 1375 # define USE_BACKUP 0 1376 #endif 1377 1378 #if USE_BACKUP 1379 # define IF_BACKUP(x) x 1380 # define IF_NO_BACKUP(x) 1381 # define BACKUP_SELECT(x,y) x 1382 #else 1383 # define IF_BACKUP(x) 1384 # define IF_NO_BACKUP(x) x 1385 # define BACKUP_SELECT(x,y) y 1386 #endif 1387 1388 1389 #undef PDP_SHUFFLE 1390 #if (VAX_FLOATING) 1391 1392 # if (BITS_PER_WORD == 32) 1393 1394 # define PDP_SHUFFLE(i) \ 1395 (((U_WORD)(i) << 16) | ((U_WORD)(i) >> 16)) 1396 1397 # elif (BITS_PER_F_TYPE < BITS_PER_WORD) 1398 1399 # define PDP_SHUFFLE(i) \ 1400 (((U_WORD)((i) & 0xffff) << 16) | ((U_WORD)(i) >> 16)) 1401 1402 # define SIGN_EXTENDED_PDP_SHUFFLE(i) \ 1403 ( (((WORD)((U_WORD)(i) << (BITS_PER_WORD - 16))) \ 1404 >> (BITS_PER_WORD - 32)) \ 1405 | ((U_WORD)(i) >> 16) ) 1406 1407 # elif (BITS_PER_WORD == 64) 1408 1409 # define PDP_SHUFFLE(i) \ 1410 ( ((U_WORD)(i) << 48) \ 1411 | ((U_WORD)(i) >> 48) \ 1412 | (((U_WORD)(i) >> 16) & ((U_WORD)0xffff << 16)) \ 1413 | (((U_WORD)(i) << 16) & ((U_WORD)0xffff << 32)) ) \ 1414 1415 # else 1416 1417 # error PDP_SHUFFLE macro not defined for this word size. 1418 1419 # endif 1420 1421 #else 1422 # define PDP_SHUFFLE(i) (i) 1423 #endif 1424 1425 /* In most cases a SIGN_EXTENDED_PDP_SHUFFLE and a PDP_SHUFFLE are the 1426 * same. So if SIGN_EXTENDED_PDP_SHUFFLE is not defined above define 1427 * it to be PDP_SHUFFLE. 1428 */ 1429 1430 #if !defined(SIGN_EXTENDED_PDP_SHUFFLE) 1431 # define SIGN_EXTENDED_PDP_SHUFFLE(i) PDP_SHUFFLE(i) 1432 #endif 1433 1434 /* 1435 * Currently _WORDS_PER_F_TYPE and _F_WORD are only used in the 1436 * xxx_LOW_BIT_yyy macros 1437 */ 1438 1439 #define _WORDS_PER_F_TYPE (BITS_PER_F_TYPE/BITS_PER_WORD) 1440 #define _F_WORD(u,n) (u).uw[ UNION_IX(_WORDS_PER_F_TYPE, n) ] 1441 1442 #if (_WORDS_PER_F_TYPE <= 1) 1443 # define OR_LOW_BITS_SET(u) 1444 # define AND_LOW_BITS_CLEAR(u) 1445 # define CLEAR_LOW_BITS(u) 1446 #elif (_WORDS_PER_F_TYPE == 2) 1447 # define OR_LOW_BITS_SET(u) | _F_WORD(u,1) 1448 # define AND_LOW_BITS_CLEAR(u) && (_F_WORD(u,1) == 0) 1449 # define CLEAR_LOW_BITS(u) (_F_WORD(u,1) = 0) 1450 #elif (_WORDS_PER_F_TYPE == 3) 1451 # define OR_LOW_BITS_SET(u) | _F_WORD(u,1) | _F_WORD(u,2) 1452 # define AND_LOW_BITS_CLEAR(u) && ((_F_WORD(u,1) | _F_WORD(u,2) == 0) 1453 # define CLEAR_LOW_BITS(u) (_F_WORD(u,1) = 0, _F_WORD(u,2) = 0) 1454 #elif (_WORDS_PER_F_TYPE == 4) 1455 # define OR_LOW_BITS_SET(u) | _F_WORD(u,1) | _F_WORD(u,2) | _F_WORD(u,3) 1456 # define AND_LOW_BITS_CLEAR(u) && ((_F_WORD(u,1) | _F_WORD(u,2) |_F_WORD(u,3)) == 0) 1457 # define CLEAR_LOW_BITS(u) (_F_WORD(u,1) = 0, _F_WORD(u,2) = 0, _F_WORD(u,3) = 0) 1458 #else 1459 # error "Unsupport combinition of WORD and F_TYPE" 1460 #endif 1461 1462 #if NEW_DPML_MACROS == 1 1463 1464 # if !defined(VAX_FLOATING) 1465 # define VAX_FLOATING 0 1466 # else 1467 # define IEEE_FLOATING 0 1468 # endif 1469 1470 # if IEEE_FLOATING 1471 # define IF_IEEE(x) x 1472 # define IF_VAX(x) 1473 # define IEEE_SELECT(x,y) x 1474 # define VMS_SELECT(x,y) y 1475 # else 1476 # define IF_IEEE(x) 1477 # define IF_VAX(x) x 1478 # define IEEE_SELECT(x,y) y 1479 # define VMS_SELECT(x,y) x 1480 # endif 1481 1482 # if SINGLE_PRECISION 1483 # define IF_SNGL(x) x 1484 # define IF_DBLE(x) 1485 # define IF_QUAD(x) 1486 # define PREC_SELECT(x,y) x 1487 # elif DOUBLE_PRECISION 1488 # define IF_SNGL(x) 1489 # define IF_DBLE(x) x 1490 # define IF_QUAD(x) 1491 # define PREC_SELECT(x,y) y 1492 # elif QUAD_PRECISION 1493 # define IF_SNGL(x) 1494 # define IF_DBLE(x) 1495 # define IF_QUAD(x) x 1496 # define PREC_SELECT(x,y) y 1497 # endif 1498 1499 # define F_HI_HALF_PRECISION (F_PRECISION - BITS_PER_F_TYPE/2) 1500 1501 # if SINGLE_PRECISION 1502 # define F_CLEAR_LO_HALF_WORD(u) (u).u16[ UNION_IX(1) ] = 0; 1503 # elif DOUBLE_PRECISION 1504 # define F_CLEAR_LO_HALF_WORD(u) (u).u32[ UNION_IX(1) ] = 0; 1505 # else /* QUAD_PRECISION */ 1506 # if BITS_PER_WORD >= 64 1507 # define F_CLEAR_LO_HALF_WORD(u) (u).u64[ UNION_IX(1) ] = 0; 1508 # else 1509 # define F_CLEAR_LO_HALF_WORD(u) (u).u32[ UNION_IX(2) ] = 0; \ 1510 (u).u32[ UNION_IX(3) ] = 0 1511 # endif 1512 # endif 1513 1514 #endif 1515 1516 #endif /* (!NO_FLOATING) */ 1517 1518 1519 #endif /* F_FORMAT_H */ 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 #if 0 1545 1546 1547 1548 typedef union { 1549 struct { 1550 #ifdef __MIPSEL 1551 unsigned fraction_low: 32; 1552 unsigned hi_bits: 20; 1553 unsigned exponent : 11; 1554 unsigned sign : 1; 1555 #else 1556 unsigned sign : 1; 1557 unsigned exponent : 11; 1558 unsigned hi_bits: 20; 1559 unsigned fraction_low: 32; 1560 #endif 1561 } bits; 1562 double d; 1563 } dnan; 1564 1565 1566 1567 typedef union { 1568 float f; 1569 unsigned long l[1]; 1570 unsigned int i[1]; 1571 unsigned short s[2]; 1572 unsigned char c[4]; 1573 struct { 1574 unsigned hi_bits : 7; 1575 unsigned exponent : 8; 1576 unsigned sign_bit : 1; 1577 unsigned char c[2]; 1578 } 1579 vax_f_float; 1580 struct { 1581 unsigned char c[2]; 1582 unsigned hi_bits : 7; 1583 unsigned exponent : 8; 1584 unsigned sign_bit : 1; 1585 } 1586 ieee_single; 1587 struct { 1588 unsigned char c[3]; 1589 unsigned exponent : 7; 1590 unsigned sign_bit : 1; 1591 } 1592 ibm_short; 1593 } 1594 REAL4; 1595 1596 typedef REAL4 *REAL4_PTR; 1597 1598 1599 1600 typedef union { 1601 double d; 1602 unsigned long l[2]; 1603 unsigned int i[2]; 1604 unsigned short s[4]; 1605 unsigned char c[8]; 1606 struct { 1607 unsigned hi_bits : 7; 1608 unsigned exponent : 8; 1609 unsigned sign_bit : 1; 1610 unsigned char c[6]; 1611 } 1612 vax_d_float; 1613 struct { 1614 unsigned hi_bits : 4; 1615 unsigned exponent : 11; 1616 unsigned sign_bit : 1; 1617 unsigned char c[6]; 1618 } 1619 vax_g_float; 1620 struct { 1621 unsigned char c[6]; 1622 unsigned hi_bits : 4; 1623 unsigned exponent : 11; 1624 unsigned sign_bit : 1; 1625 } 1626 ieee_double; 1627 struct { 1628 unsigned char c[7]; 1629 unsigned exponent : 7; 1630 unsigned sign_bit : 1; 1631 } 1632 ibm_long; 1633 struct { 1634 unsigned char c[6]; 1635 unsigned exponent : 15; 1636 unsigned sign_bit : 1; 1637 } 1638 cray; 1639 } 1640 REAL8; 1641 1642 typedef REAL8 *REAL8_PTR; 1643 1644 1645 1646 typedef union { 1647 unsigned long l[4]; 1648 unsigned int i[4]; 1649 unsigned short s[8]; 1650 unsigned char c[16]; 1651 struct { 1652 /* 1653 unsigned hi_bits : 0; 1654 */ 1655 unsigned exponent : 15; 1656 unsigned sign_bit : 1; 1657 unsigned char c[14]; 1658 } vax_h_float; 1659 } REAL16; 1660 1661 typedef REAL16 *REAL16_PTR; 1662 1663 #endif 1664 1665 1666