Changeset 274b9d99 in mainline for uspace/lib/math/generic/internal.h
- Timestamp:
- 2021-06-18T16:02:27Z (3 years ago)
- Children:
- 21d5236
- Parents:
- 034ce6bb
- git-author:
- Manuele Conti <manuele.conti@…> (2018-11-23 22:28:26)
- git-committer:
- Maurizio Lombardi <mlombard@…> (2021-06-18 16:02:27)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/math/generic/internal.h
r034ce6bb r274b9d99 31 31 #define MATH_INTERNAL_H_ 32 32 33 #include <stdint.h> 34 35 #if __BE__ 36 37 typedef union 38 { 39 double value; 40 struct 41 { 42 uint32_t msw; 43 uint32_t lsw; 44 } parts; 45 uint64_t word; 46 } ieee_double_shape_type; 47 48 #endif 49 50 #if __LE__ 51 52 typedef union 53 { 54 double value; 55 struct 56 { 57 uint32_t lsw; 58 uint32_t msw; 59 } parts; 60 uint64_t word; 61 } ieee_double_shape_type; 62 63 #endif 64 65 #define EXTRACT_WORDS(ix0,ix1,d) \ 66 do { \ 67 ieee_double_shape_type ew_u; \ 68 ew_u.value = (d); \ 69 (ix0) = ew_u.parts.msw; \ 70 (ix1) = ew_u.parts.lsw; \ 71 } while (0) 72 73 /* Get the more significant 32 bit int from a double. */ 74 #ifndef GET_HIGH_WORD 75 # define GET_HIGH_WORD(i,d) \ 76 do { \ 77 ieee_double_shape_type gh_u; \ 78 gh_u.value = (d); \ 79 (i) = gh_u.parts.msw; \ 80 } while (0) 81 #endif 82 83 /* Get the less significant 32 bit int from a double. */ 84 #ifndef GET_LOW_WORD 85 # define GET_LOW_WORD(i,d) \ 86 do { \ 87 ieee_double_shape_type gl_u; \ 88 gl_u.value = (d); \ 89 (i) = gl_u.parts.lsw; \ 90 } while (0) 91 #endif 92 93 /* Get all in one, efficient on 64-bit machines. */ 94 #ifndef EXTRACT_WORDS64 95 # define EXTRACT_WORDS64(i,d) \ 96 do { \ 97 ieee_double_shape_type gh_u; \ 98 gh_u.value = (d); \ 99 (i) = gh_u.word; \ 100 } while (0) 101 #endif 102 103 /* Set a double from two 32 bit ints. */ 104 #ifndef INSERT_WORDS 105 # define INSERT_WORDS(d,ix0,ix1) \ 106 do { \ 107 ieee_double_shape_type iw_u; \ 108 iw_u.parts.msw = (ix0); \ 109 iw_u.parts.lsw = (ix1); \ 110 (d) = iw_u.value; \ 111 } while (0) 112 #endif 113 114 /* Get all in one, efficient on 64-bit machines. */ 115 #ifndef INSERT_WORDS64 116 # define INSERT_WORDS64(d,i) \ 117 do { \ 118 ieee_double_shape_type iw_u; \ 119 iw_u.word = (i); \ 120 (d) = iw_u.value; \ 121 } while (0) 122 #endif 123 124 /* Set the more significant 32 bits of a double from an int. */ 125 #ifndef SET_HIGH_WORD 126 #define SET_HIGH_WORD(d,v) \ 127 do { \ 128 ieee_double_shape_type sh_u; \ 129 sh_u.value = (d); \ 130 sh_u.parts.msw = (v); \ 131 (d) = sh_u.value; \ 132 } while (0) 133 #endif 134 135 /* Set the less significant 32 bits of a double from an int. */ 136 #ifndef SET_LOW_WORD 137 # define SET_LOW_WORD(d,v) \ 138 do { \ 139 ieee_double_shape_type sl_u; \ 140 sl_u.value = (d); \ 141 sl_u.parts.lsw = (v); \ 142 (d) = sl_u.value; \ 143 } while (0) 144 #endif 145 146 33 147 float __math_base_sin_32(float); 34 148 float __math_base_cos_32(float);
Note:
See TracChangeset
for help on using the changeset viewer.