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.
Addresses #2170
- fixed: `interval-bitor` caused bit-growth
- improved: `interval-bitor` more exact about lower bounds
The added utility words could be used as a basis to make the other bitwise
interval operations more exact also.
Make both `empty-interval` and `full-interval` singletons, use generic functions
and methods where they are special-cased.
All words which work with interval points should also now work with the special
intervals.
- declared input type for bignum-shift was stricter than the runtime behavior, leading to bad propagation of type info if shift count was a bignum
- types inferred for type functions which used number-valued/integer-valued/real-valued were not always precise, eg bignum bignum bitxor => integer
- add interval-log2, type function for (log2)
- remove math-class-min, it was useless