xref: /illumos-gate/usr/src/common/util/i386/muldiv.h (revision 89518a1cfe5021ecf5ad8d04c40f53cf947e95d9)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 
23 /*
24  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
25  * Use is subject to license terms.
26  */
27 
28 #ifndef _MULDIV_H
29 #define	_MULDIV_H
30 
31 #pragma ident	"%Z%%M%	%I%	%E% SMI"
32 
33 /*
34  * Helper routines for Sun and GCC compilers in 32-bit mode,
35  * doing 64-bit math.  These routines should not be called directly;
36  * they are called by code generated by the compiler.  Their declarations
37  * are here for kmdb's hdr2map and map2linktest mechanisms.
38  */
39 
40 #if !defined(__amd64)
41 
42 #ifdef __cplusplus
43 extern "C" {
44 #endif
45 
46 extern int64_t __mul64(int64_t a, int64_t b);
47 
48 extern uint64_t __udiv64(uint64_t x, uint64_t y);
49 extern uint64_t __urem64(uint64_t x, uint64_t y);
50 extern int64_t __div64(int64_t x, int64_t y);
51 extern int64_t __rem64(int64_t x, int64_t y);
52 
53 extern uint64_t __udivdi3(uint64_t a, uint64_t b);
54 extern uint64_t __umoddi3(uint64_t a, uint64_t b);
55 extern int64_t __divdi3(int64_t a, int64_t b);
56 extern int64_t __moddi3(int64_t a, int64_t b);
57 
58 extern uint64_t __udivrem64(uint64_t x, uint64_t y);
59 extern int64_t __divrem64(int64_t x, int64_t y);
60 
61 #ifdef __cplusplus
62 }
63 #endif
64 
65 #endif /* !defined(amd64) */
66 
67 #endif /* _MULDIV_H */
68