diff options
author | zimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4> | 2018-08-28 14:44:47 +0000 |
---|---|---|
committer | zimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4> | 2018-08-28 14:44:47 +0000 |
commit | bef5b39b4aee607d8417e0034b64f6a858d0085f (patch) | |
tree | 1f0e0d86a4bf0875ab8fe83fa140bc384f5923c6 /src/get_ld.c | |
parent | b2e13b2b448b7803f09ea50387c4f8f4ac664596 (diff) | |
download | mpfr-bef5b39b4aee607d8417e0034b64f6a858d0085f.tar.gz |
[src/get_ld.c] adapt to GMP_NUMB_BITS=16
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@13061 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'src/get_ld.c')
-rw-r--r-- | src/get_ld.c | 34 |
1 files changed, 33 insertions, 1 deletions
diff --git a/src/get_ld.c b/src/get_ld.c index 92d77e165..cb0e0c63c 100644 --- a/src/get_ld.c +++ b/src/get_ld.c @@ -94,8 +94,40 @@ mpfr_get_ld (mpfr_srcptr x, mpfr_rnd_t rnd_mode) ld.s.manl = tmpmant[1] >> (denorm - 32); ld.s.manh = 0; } +#elif GMP_NUMB_BITS == 16 + if (MPFR_LIKELY (denorm == 0)) + { + ld.s.manl = tmpmant[0] | ((unsigned int) tmpmant[1] << 16); + ld.s.manh = tmpmant[2] | ((unsigned int) tmpmant[3] << 16); + } + else if (denorm < 16) + { + ld.s.manl = (tmpmant[0] >> denorm) + | ((unsigned int) tmpmant[1] << (16 - denorm)) + | ((unsigned int) tmpmant[2] << (32 - denorm)); + ld.s.manh = (tmpmant[2] >> denorm) + | ((unsigned int) tmpmant[3] << (16 - denorm)); + } + else if (denorm < 32) + { + ld.s.manl = (tmpmant[1] >> (denorm - 16)) + | ((unsigned int) tmpmant[2] << (32 - denorm)) + | ((unsigned int) tmpmant[3] << (48 - denorm)); + ld.s.manh = tmpmant[3] >> (denorm - 16); + } + else if (denorm < 48) + { + ld.s.manl = (tmpmant[2] >> (denorm - 32)) + | ((unsigned int) tmpmant[3] << (64 - denorm)); + ld.s.manh = 0; + } + else /* 48 <= denorm < 64 */ + { + ld.s.manl = tmpmant[3] >> (denorm - 48); + ld.s.manh = 0; + } #else -# error "GMP_NUMB_BITS must be 32 or >= 64" +# error "GMP_NUMB_BITS must be 16, 32 or >= 64" /* Other values have never been supported anyway. */ #endif if (MPFR_LIKELY (denorm == 0)) |