File:  [CSRG BSD Unix] / 43BSDTahoe / sys / tahoe / udiv.s
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Tue Apr 24 16:12:58 2018 UTC (8 years, 1 month ago) by root
Branches: MAIN, BSD
CVS tags: HEAD, BSD43tahoe
BSD 4.3tahoe

/*
 *	@(#)udiv.s	7.1 (Berkeley) 5/21/88
 */

#include "../tahoe/SYS.h"

/*
 * result = udiv(dividend, divisor)
 *
 * unsigned long division
 */
	.text
ASENTRY(udiv, R2|R3)
	bitl	$0x80000000,8(fp)	# if (divisor & 0x80000000) {
	jeql	2f			  
	cmpl	8(fp),4(fp)		# if (divisor > dividend)
	jlequ	1f
	clrl	r0			#	return (0);
	ret
1:					# else
	movl	$1,r0			#  	return (1);
	ret				# }
2:
	clrl	r0			# return (dividend / divisor);
	movl	4(fp),r1
	ediv	8(fp),r0,r2,r3
	movl	r2,r0
	ret

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.