Rev | Line | |
---|
[9] | 1 | /*
|
---|
| 2 | libc/ieee_float/ieee_float.h
|
---|
| 3 |
|
---|
| 4 | Created: Oct 14, 1993 by Philip Homburg <philip@cs.vu.nl>
|
---|
| 5 |
|
---|
| 6 | Define structures and macros for manipulating IEEE floats
|
---|
| 7 | */
|
---|
| 8 |
|
---|
| 9 | #ifndef IEEE_FLOAT_H
|
---|
| 10 | #define IEEE_FLOAT_H
|
---|
| 11 |
|
---|
| 12 | #define isnan __IsNan
|
---|
| 13 |
|
---|
| 14 | struct f64
|
---|
| 15 | {
|
---|
| 16 | u32_t low_word;
|
---|
| 17 | u32_t high_word;
|
---|
| 18 | };
|
---|
| 19 |
|
---|
| 20 | #define F64_SIGN_SHIFT 31
|
---|
| 21 | #define F64_SIGN_MASK 1
|
---|
| 22 |
|
---|
| 23 | #define F64_EXP_SHIFT 20
|
---|
| 24 | #define F64_EXP_MASK 0x7ff
|
---|
| 25 | #define F64_EXP_BIAS 1023
|
---|
| 26 | #define F64_EXP_MAX 2047
|
---|
| 27 |
|
---|
| 28 | #define F64_MANT_SHIFT 0
|
---|
| 29 | #define F64_MANT_MASK 0xfffff
|
---|
| 30 |
|
---|
| 31 | #define F64_GET_SIGN(fp) (((fp)->high_word >> F64_SIGN_SHIFT) & \
|
---|
| 32 | F64_SIGN_MASK)
|
---|
| 33 | #define F64_GET_EXP(fp) (((fp)->high_word >> F64_EXP_SHIFT) & \
|
---|
| 34 | F64_EXP_MASK)
|
---|
| 35 | #define F64_SET_EXP(fp, val) ((fp)->high_word= ((fp)->high_word & \
|
---|
| 36 | ~(F64_EXP_MASK << F64_EXP_SHIFT)) | \
|
---|
| 37 | (((val) & F64_EXP_MASK) << F64_EXP_SHIFT))
|
---|
| 38 |
|
---|
| 39 | #define F64_GET_MANT_LOW(fp) ((fp)->low_word)
|
---|
| 40 | #define F64_SET_MANT_LOW(fp, val) ((fp)->low_word= (val))
|
---|
| 41 | #define F64_GET_MANT_HIGH(fp) (((fp)->high_word >> F64_MANT_SHIFT) & \
|
---|
| 42 | F64_MANT_MASK)
|
---|
| 43 | #define F64_SET_MANT_HIGH(fp, val) ((fp)->high_word= ((fp)->high_word & \
|
---|
| 44 | ~(F64_MANT_MASK << F64_MANT_SHIFT)) | \
|
---|
| 45 | (((val) & F64_MANT_MASK) << F64_MANT_SHIFT))
|
---|
| 46 |
|
---|
| 47 | #endif /* IEEE_FLOAT_H */
|
---|
| 48 |
|
---|
| 49 | /*
|
---|
| 50 | * $PchId: ieee_float.h,v 1.3 1996/02/22 21:01:39 philip Exp $
|
---|
| 51 | */
|
---|
Note:
See
TracBrowser
for help on using the repository browser.