fixnum - Factor Documentation (original) (raw)

Class description
The class of fixnums, which are fixed-width integers small enough to fit in a machine cell. Because they are not heap-allocated, fixnums do not have object identity. Equality of tagged pointer bit patterns is actually value equality for fixnums.

USING: kernel.private math math.bitwise.private ;

M: fixnum (bit-count) fixnum-bit-count { fixnum } declare ;
inline

USING: bootstrap.image.private kernel math ;

M: fixnum (eql?) eq? ;

USING: kernel.private math math.functions.private ;

M: fixnum (integer-log10)
fixnum-integer-log10 { fixnum } declare ; inline

USING: kernel.private math math.integers.private math.private ;

M: fixnum (log2) fixnum-log2 { fixnum } declare ; inline

USING: math math.private ;

M: fixnum * fixnum* ; inline

USING: math math.private ;

M: fixnum + fixnum+ ; inline

USING: math math.private ;

M: fixnum - fixnum- ; inline

USING: kernel kernel.private math math.integers.private ;

M: fixnum /f
{ fixnum fixnum } declare 2dup
[ abs bignum/f-threshold >= ] either?
[ bignum/f ] [ fixnum/f ] if ; inline

USING: math math.private ;

M: fixnum /i fixnum/i ; inline

USING: math math.private ;

M: fixnum /mod fixnum/mod ; inline

USING: math math.private ;

M: fixnum < fixnum< ; inline

USING: math math.private ;

M: fixnum <= fixnum<= ; inline

USING: math math.private ;

M: fixnum > fixnum> ; inline

USING: math math.private ;

M: fixnum >= fixnum>= ; inline

USING: arrays asn1 kernel math pack sequences ;

M: fixnum >ber
>128-ber dup length 2 swap 2array "cc" pack-native
B{ } prepend-as ;

USING: math math.private ;

M: fixnum >bignum fixnum>bignum ; inline

USING: math ;

M: fixnum >fixnum ; inline

USING: math math.private ;

M: fixnum >float fixnum>float ; inline

USING: math ;

M: fixnum >integer ; inline

USING: math python python.errors python.ffi ;

M: fixnum >py PyLong_FromLong check-new-ref ;

USING: math math.functions.private ;

M: fixnum ^n (^n) ;

USING: math math.integers.private ;

M: fixnum bit? integer>fixnum-strict fixnum-bit? ; inline

USING: math math.private ;

M: fixnum bitand fixnum-bitand ; inline

USING: math math.private ;

M: fixnum bitnot fixnum-bitnot ; inline

USING: math math.private ;

M: fixnum bitor fixnum-bitor ; inline

USING: math math.private ;

M: fixnum bitxor fixnum-bitxor ; inline

USING: compiler.tree.propagation.info kernel math ;

M: fixnum eql? eq? ;

USING: kernel math math.private ;

M: fixnum equal?
over bignum? [ >bignum bignum= ] [ 2drop f ] if ; inline

USING: elevate.private kernel math ;

M: fixnum failed-process? -1 = ;

USING: kernel math ;

M: fixnum hashcode* nip ; inline

USING: math ;

M: fixnum integer>fixnum ; inline

USING: math ;

M: fixnum integer>fixnum-strict ; inline

USING: generic kernel math math.integers.private math.order ;

M: fixnum max
over fixnum?
[ fixnum-max ] [ M\ fixnum max (call-next-method) ] if ;
inline

USING: generic kernel math math.integers.private math.order ;

M: fixnum min
over fixnum?
[ fixnum-min ] [ M\ fixnum min (call-next-method) ] if ;
inline

USING: math math.private ;

M: fixnum mod fixnum-mod ; inline

USING: combinators generic math namespaces tools.deploy.test.7 ;

M: fixnum my-generic
M\ fixnum my-generic (call-next-method)
my-var get ( a -- b ) call-effect ;

USING: kernel math ;

M: fixnum number= eq? ; inline

USING: kernel math math.parser.private sbufs sequences ;

M: fixnum positive>dec
1 over count-digits fixnum>dec "" like reverse! nip ;
inline

USING: bootstrap.image.private kernel layouts math math.order ;

M: fixnum prepare-object
dup bootstrap-most-negative-fixnum
bootstrap-most-positive-fixnum between?
[ tag-fixnum ] [ >bignum prepare-object ] if ;

USING: math random random.private ;

M: fixnum random* random-integer ;

USING: kernel.private math math.order.private ;

M: fixnum real<=> { fixnum fixnum } declare (real<=>) ; inline

USING: math math.private ;

M: fixnum shift integer>fixnum fixnum-shift ; inline

USING: math math.private ;

M: fixnum simple-gcd fixnum-gcd ; inline

USING: kernel layouts math math.cardinality ;

M: fixnum trailing-zeros
[ fixnum-bits ]
[ 0 [ over even? ] [ [ 2/ ] [ 1 + ] bi* ] while nip ]
if-zero ;

USING: math math.private ;

M: fixnum u< fixnum< ; inline

USING: math math.private ;

M: fixnum u<= fixnum<= ; inline

USING: math math.private ;

M: fixnum u> fixnum> ; inline

USING: math math.private ;

M: fixnum u>= fixnum>= ; inline