12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788 |
- #ifndef __UVISION_VERSION
- #include <stdint.h>
- typedef union {
- double value;
- struct {
- uint32_t lsw;
- uint32_t msw;
- } parts;
- } ieee_double_shape_type;
- #define EXTRACT_WORDS(ix0,ix1,d) \
- do { \
- ieee_double_shape_type ew_u; \
- ew_u.value = (d); \
- (ix0) = ew_u.parts.msw; \
- (ix1) = ew_u.parts.lsw; \
- } while (0)
- #define GET_HIGH_WORD(i,d) \
- do { \
- ieee_double_shape_type gh_u; \
- gh_u.value = (d); \
- (i) = gh_u.parts.msw; \
- } while (0)
- #define SET_HIGH_WORD(d,v) \
- do { \
- ieee_double_shape_type sh_u; \
- sh_u.value = (d); \
- sh_u.parts.msw = (v); \
- (d) = sh_u.value; \
- } while (0)
- double fabs(double x)
- {
- uint32_t high;
- GET_HIGH_WORD(high,x);
- SET_HIGH_WORD(x,high&0x7fffffff);
- return x;
- }
- #endif
|