diff options
author | David Cournapeau <cournape@gmail.com> | 2009-07-27 02:23:15 +0000 |
---|---|---|
committer | David Cournapeau <cournape@gmail.com> | 2009-07-27 02:23:15 +0000 |
commit | 5019d2c835ff1c70f591b9c97c9a27d89d5c550d (patch) | |
tree | 70fb46d4034561b146ad2852b7793b4c813911b0 /numpy | |
parent | b5a150d9596f46d1e68fa563f1d9e89e72242a63 (diff) | |
download | numpy-5019d2c835ff1c70f591b9c97c9a27d89d5c550d.tar.gz |
Add missing SET_HIGH_WORD and SET_LOW_WORD to do bitwise op on IEEE754 double - needed for our copysign replacement.
Diffstat (limited to 'numpy')
-rw-r--r-- | numpy/core/src/npymath/npy_math_private.h | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/numpy/core/src/npymath/npy_math_private.h b/numpy/core/src/npymath/npy_math_private.h index ecdbfe434..ea7c47fe8 100644 --- a/numpy/core/src/npymath/npy_math_private.h +++ b/numpy/core/src/npymath/npy_math_private.h @@ -98,4 +98,24 @@ do { \ (i) = gl_u.parts.lsw; \ } while (0) +/* Set the more significant 32 bits of a double from an int. */ + +#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) + +/* Set the less significant 32 bits of a double from an int. */ + +#define SET_LOW_WORD(d,v) \ +do { \ + ieee_double_shape_type sl_u; \ + sl_u.value = (d); \ + sl_u.parts.lsw = (v); \ + (d) = sl_u.value; \ +} while (0) + #endif /* !_NPY_MATH_PRIVATE_H_ */ |