factor/basis/math/intervals
John Benediktsson e256a4ba18 math.intervals: workaround possible compiler bug by widening interval-bitor.
IN: scratchpad [
                   { byte-array } declare
                   [ 0 alien-unsigned-4 32 shift ]
                   [ 4 alien-unsigned-4 ] bi bitor
                   64 >signed
               ] optimized.

! working
[
    dup >R 0 alien-unsigned-4 32 fixnum-shift
    R> 4 alien-unsigned-4 over tag 0 eq?
    [ fixnum-bitor ] [ fixnum>bignum bignum-bitor ] if
    18446744073709551615 >R >bignum R> bignum-bitand
    dup 63 bignum-bit? [ 18446744073709551616 bignum- ] [ ] if
]

! broken
[
    dup >R 0 alien-unsigned-4 32 fixnum-shift
    R> 4 alien-unsigned-4 over tag 0 eq?
    [ fixnum-bitor ] [ fixnum>bignum bignum-bitor ] if
    dup 63 bignum-bit? [ 18446744073709551616 bignum- ] [ ] if
]

The second case correctly eliminates the bitand but incorrectly assumes
that the item on the stack (which is an integer -- either a fixnum or a
bignum), was converted to a bignum.
2019-10-31 10:45:54 -07:00
..
authors.txt Create basis vocab root 2008-07-28 22:03:13 -05:00
intervals-docs.factor improve help by linking to types directly. 2014-05-23 20:20:15 -07:00
intervals-tests.factor math.intervals: workaround possible compiler bug by widening interval-bitor. 2019-10-31 10:45:54 -07:00
intervals.factor math.intervals: workaround possible compiler bug by widening interval-bitor. 2019-10-31 10:45:54 -07:00
summary.txt Create basis vocab root 2008-07-28 22:03:13 -05:00