minix/lib/i86/int64/div64u.s

27 lines
553 B
ArmAsm
Raw Normal View History

2005-04-21 16:53:53 +02:00
! div64u() - 64 bit divided by unsigned giving unsigned long
! Author: Kees J. Bot
! 24 Dec 1995
.sect .text
.define _div64u, _rem64u
_div64u: ! unsigned long div64u(u64_t i, unsigned j);
mov bx, sp
div64u: xor dx, dx
mov ax, 8(bx)
div 10(bx)
mov ax, 6(bx)
div 10(bx)
mov ax, 4(bx)
div 10(bx) ! division bits 16-31
mov cx, ax
mov ax, 2(bx)
div 10(bx) ! division bits 0-15
xchg dx, cx ! division in dx:ax, remainder in cx
ret
_rem64u: ! unsigned rem64u(u64_t i, unsigned j);
mov bx, sp
call div64u
mov ax, cx
ret