/****************************************************************************/
/*	Copyright (c) 2009, Bendor Research Pty. Ltd. All rights reserved.		*/
/*	This software is released under the GNU General Public License, version	*/
/*	3, with the exemptions that 1) the header files installed by this 	 	*/
/*	package can be included in closed-source code and 2) the libraries		*/
/*	built by this package can be statically linked into a closed-source 	*/
/*	binary. See the file LICENSE for the details.							*/
/*	This software is provided "AS IS", without any warranty or guarantee.	*/
/*	By using this software you acknowledge that neither Bendor Research nor	*/
/*	any of its personnel or affiliates can be held liable for any damages,	*/
/*	including, but not limited to, loss of business, loss of money, loss of */
/*	life, loss of reputation, arising out of this software being faulty or	*/
/*	not performing as advertised, even if Bendor Research was aware of such	*/
/*	faults in the software. You use this software at your own risk, any and */
/*	all liabilities that arise out of your using this software are strictly	*/
/*	yours.																	*/
/****************************************************************************/

#include <arm_func.h>

	afunc	div
	stmdb	sp!,{r0,r4}
	mov		r12,lr
	mov		r4,#0
	movs	r0,r1
	eormi	r4,r4,#3
	rsbmi	r0,r0,#0
	movs	r1,r2
	eormi	r4,r4,#2
	rsbmi	r1,r1,#0
	bl		_bgs_udiv32
	tst		r4,#1
	rsbmi	r1,r1,#0
	tst		r4,#2
	rsbmi	r0,r0,#0
	ldmia	sp!,{r2,r4}
	stmia	r2,{r0,r1}
	bx		r12

