Changeset 13530


Ignore:
Timestamp:
Mar 15, 2010, 5:58:56 AM (10 years ago)
Author:
gb
Message:

Make (%FIXNUM-TRUNCATE n d) handle the case where d i -1; the result
is (values (- n) 0) in that case. If N is MOST-NEGATIVE-FIXNUM, then
(- n) is *LEAST-POSITIVE-BIGNUM*; in other cases, it's just
(THE FIXNUM (- N))

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/level-0/PPC/ppc-numbers.lisp

    r13328 r13530  
    203203
    204204
    205 ;;;; maybe this could be smarter but frankly scarlett I dont give a damn
     205;;; maybe this could be smarter but frankly scarlett I dont give a damn
     206;;; ticket:666 describes one reason to give a damn.
    206207#+ppc32-target
    207208(defppclapfunction %fixnum-truncate ((dividend arg_y) (divisor arg_z))
     
    213214        (boxed-quotient temp1)
    214215        (remainder temp2))
     216    (cmpwi divisor '-1)   
    215217    (unbox-fixnum unboxed-dividend dividend)
    216218    (unbox-fixnum unboxed-divisor divisor)
     219    (beq @neg)
    217220    (divwo. unboxed-quotient unboxed-dividend unboxed-divisor)          ; set OV if divisor = 0
    218221    (box-fixnum boxed-quotient unboxed-quotient)
     
    232235    (set-nargs 2)
    233236    (la temp0 8 vsp)
     237    (ba .SPvalues)
     238    @neg
     239    (nego. dividend dividend)
     240    (lwz arg_z '*least-positive-bignum* nfn)
     241    (bns @ret)
     242    (mtxer rzero)
     243    (lwz dividend ppc32::symbol.vcell arg_z)
     244    @ret
     245    (mr temp0 vsp)
     246    (vpush dividend)
     247    (vpush rzero)
     248    (set-nargs 2)
    234249    (ba .SPvalues)))
    235250
     
    243258        (boxed-quotient temp1)
    244259        (remainder temp2))
     260    (cmpdi divisor '-1)
    245261    (unbox-fixnum unboxed-dividend dividend)
    246262    (unbox-fixnum unboxed-divisor divisor)
     263    (beq @neg)
    247264    (divdo. unboxed-quotient unboxed-dividend unboxed-divisor)          ; set OV if divisor = 0
    248265    (box-fixnum boxed-quotient unboxed-quotient)
     
    262279    (set-nargs 2)
    263280    (la temp0 '2 vsp)
    264     (ba .SPvalues)))
     281    (ba .SPvalues)
     282    @neg
     283    (nego. dividend dividend)
     284    (ld arg_z '*least-positive-bignum* nfn)
     285    (bns @ret)
     286    (mtxer rzero)
     287    (ld dividend ppc64::symbol.vcell arg_z)
     288    @ret
     289    (mr temp0 vsp)
     290    (vpush dividend)
     291    (vpush rzero)
     292    (set-nargs 2)
     293    (ba .SPvalues)   
     294    ))
    265295
    266296
Note: See TracChangeset for help on using the changeset viewer.