divufr.c revision 1.4 1 1.4 thorpej /* $NetBSD: divufr.c,v 1.4 2007/02/22 05:46:29 thorpej Exp $ */
2 1.1 fredette
3 1.1 fredette /* $OpenBSD: divufr.c,v 1.5 2001/03/29 03:58:18 mickey Exp $ */
4 1.1 fredette
5 1.1 fredette /*
6 1.1 fredette * Copyright 1996 1995 by Open Software Foundation, Inc.
7 1.1 fredette * All Rights Reserved
8 1.1 fredette *
9 1.1 fredette * Permission to use, copy, modify, and distribute this software and
10 1.1 fredette * its documentation for any purpose and without fee is hereby granted,
11 1.1 fredette * provided that the above copyright notice appears in all copies and
12 1.1 fredette * that both the copyright notice and this permission notice appear in
13 1.1 fredette * supporting documentation.
14 1.1 fredette *
15 1.1 fredette * OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE
16 1.1 fredette * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
17 1.1 fredette * FOR A PARTICULAR PURPOSE.
18 1.1 fredette *
19 1.1 fredette * IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR
20 1.1 fredette * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
21 1.1 fredette * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT,
22 1.1 fredette * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
23 1.1 fredette * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
24 1.1 fredette *
25 1.1 fredette */
26 1.1 fredette /*
27 1.1 fredette * pmk1.1
28 1.1 fredette */
29 1.1 fredette /*
30 1.1 fredette * (c) Copyright 1986 HEWLETT-PACKARD COMPANY
31 1.1 fredette *
32 1.1 fredette * To anyone who acknowledges that this file is provided "AS IS"
33 1.1 fredette * without any express or implied warranty:
34 1.1 fredette * permission to use, copy, modify, and distribute this file
35 1.1 fredette * for any purpose is hereby granted without fee, provided that
36 1.1 fredette * the above copyright notice and this notice appears in all
37 1.1 fredette * copies, and that the name of Hewlett-Packard Company not be
38 1.1 fredette * used in advertising or publicity pertaining to distribution
39 1.1 fredette * of the software without specific, written prior permission.
40 1.1 fredette * Hewlett-Packard Company makes no representations about the
41 1.1 fredette * suitability of this software for any purpose.
42 1.1 fredette */
43 1.1 fredette
44 1.2 lukem #include <sys/cdefs.h>
45 1.4 thorpej __KERNEL_RCSID(0, "$NetBSD: divufr.c,v 1.4 2007/02/22 05:46:29 thorpej Exp $");
46 1.1 fredette
47 1.1 fredette #include "md.h"
48 1.1 fredette
49 1.1 fredette void
50 1.1 fredette divufr(opnd1,opnd2,result)
51 1.1 fredette
52 1.1 fredette unsigned int opnd1, opnd2;
53 1.1 fredette struct mdsfu_register *result;
54 1.1 fredette {
55 1.1 fredette /* check divisor for zero */
56 1.1 fredette if (opnd2 == 0) {
57 1.4 thorpej overflow = true;
58 1.1 fredette return;
59 1.1 fredette }
60 1.1 fredette
61 1.1 fredette /* check for overflow */
62 1.1 fredette if (opnd1 >= opnd2) {
63 1.4 thorpej overflow = true;
64 1.1 fredette return;
65 1.1 fredette }
66 1.4 thorpej overflow = false;
67 1.1 fredette
68 1.1 fredette /* do the divide */
69 1.1 fredette divu(opnd1,0,opnd2,result);
70 1.1 fredette return;
71 1.1 fredette }
72