home *** CD-ROM | disk | FTP | other *** search
- ; unsigned long integer multiplication routine
- ;
- ; written by Kai-Uwe Bloem (I5110401@dbstu1.bitnet).
- ;
- ;
- ; Revision 1.1, kub 03-90
- ; first version, replaces the appropriate routine from fixnum.s.
- ; This one is short and fast for the common case of both longs <= 0x0000ffff,
- ; but the case of a zero lowword is no longer recognized.
- ; (besides it's easier to read this source 8-)
-
- text
- even
- xdef __CXM33
-
- __CXM33:
- movem.l d2-d3,-(sp)
- move.l d1,d2
- move.l d1,d3
- swap d2
- move.l d0,d1
- swap d0
-
- ext.l d0 ; u.h <> 0 ?
- beq.s 1$
- mulu.w d3,d0 ; r = v.l * u.h
- 1$ tst.w d2 ; v.h <> 0 ?
- beq.s 2$
- mulu.w d1,d2 ; r += v.h * u.l
- add.w d2,d0
- 2$ swap d0
- clr.w d0
- mulu.w d3,d1 ; r += v.l * u.l
- add.l d1,d0
- movem.l (sp)+,d2-d3
- rts
- end
-