diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2011-12-21 16:01:38 -0800 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2011-12-21 16:01:38 -0800 |
commit | 817ce30b100bf7897ca86a8737eb7a12bd558eb4 (patch) | |
tree | 9ca0fccef82191facf5a29dd2664615827792447 /mpi-patches/bit-search-optimizations | |
parent | b4b045a8e7c65783d94812553e31ae0282e80cc4 (diff) | |
download | txr-817ce30b100bf7897ca86a8737eb7a12bd558eb4.tar.gz txr-817ce30b100bf7897ca86a8737eb7a12bd558eb4.tar.bz2 txr-817ce30b100bf7897ca86a8737eb7a12bd558eb4.zip |
* mpi-patches/bit-search-optimizations (s_highest_bit):
It will take days to completely wipe the egg off my face.
I forgot to fix this code for unsigned integers before
pasting it into MPI.
Diffstat (limited to 'mpi-patches/bit-search-optimizations')
-rw-r--r-- | mpi-patches/bit-search-optimizations | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/mpi-patches/bit-search-optimizations b/mpi-patches/bit-search-optimizations index d9b4357d..ccbdae79 100644 --- a/mpi-patches/bit-search-optimizations +++ b/mpi-patches/bit-search-optimizations @@ -1,7 +1,7 @@ Index: mpi-1.8.6/mpi.c =================================================================== ---- mpi-1.8.6.orig/mpi.c 2011-12-12 21:55:35.000000000 -0800 -+++ mpi-1.8.6/mpi.c 2011-12-12 21:55:45.000000000 -0800 +--- mpi-1.8.6.orig/mpi.c 2011-12-21 15:57:17.000000000 -0800 ++++ mpi-1.8.6/mpi.c 2011-12-21 15:57:49.000000000 -0800 @@ -2908,6 +2908,218 @@ /* }}} */ @@ -9,12 +9,12 @@ Index: mpi-1.8.6/mpi.c +static int s_highest_bit(mp_digit n) +{ +#if MP_DIGIT_SIZE == 8 -+ if (n & 0x7FFFFFFF00000000) { -+ if (n & 0x7FFF000000000000) { -+ if (n & 0x7F00000000000000) { -+ if (n & 0x7000000000000000) { -+ if (n & 0x4000000000000000) -+ return 63; ++ if (n & 0xFFFFFFFF00000000) { ++ if (n & 0xFFFF000000000000) { ++ if (n & 0xFF00000000000000) { ++ if (n & 0xF000000000000000) { ++ if (n & 0xC000000000000000) ++ return (n & 0x8000000000000000) ? 64 : 63; + else + return (n & 0x2000000000000000) ? 62 : 61; + } else { @@ -119,11 +119,11 @@ Index: mpi-1.8.6/mpi.c + } + } +#elif MP_DIGIT_SIZE == 4 -+ if (n & 0x7FFF0000) { -+ if (n & 0x7F000000) { -+ if (n & 0x70000000) { -+ if (n & 0x40000000) -+ return 31; ++ if (n & 0xFFFF0000) { ++ if (n & 0xFF000000) { ++ if (n & 0xF0000000) { ++ if (n & 0xC0000000) ++ return (n & 0x80000000) ? 32 : 31; + else + return (n & 0x20000000) ? 30 : 29; + } else { |