fixnum-shift didn't work with very large negative shift counts; BRANCHLESS_MAX macro was wrong

db4
Slava Pestov 2008-11-28 08:34:30 -06:00
parent f44506089d
commit 2863da257b
1 changed files with 2 additions and 2 deletions

View File

@ -86,8 +86,8 @@ void primitive_fixnum_divmod(void)
* If we're shifting right by n bits, we won't overflow as long as none of the
* high WORD_SIZE-TAG_BITS-n bits are set.
*/
#define SIGN_MASK(x) ((x) >> (CELLS * 8 - 1))
#define BRANCHLESS_MAX(x,y) (x - ((x - y) & SIGN_MASK(x - y)))
#define SIGN_MASK(x) ((x) >> (WORD_SIZE - 1))
#define BRANCHLESS_MAX(x,y) ((x) - (((x) - (y)) & SIGN_MASK((x) - (y))))
#define BRANCHLESS_ABS(x) ((x ^ SIGN_MASK(x)) - SIGN_MASK(x))
void primitive_fixnum_shift(void)