xref: /illumos-gate/usr/src/common/util/i386/muldiv.h (revision c40a6cd785e883b3f052b122c332e21174fc1871)
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 /*
32  * Helper routines for Sun and GCC compilers in 32-bit mode,
33  * doing 64-bit math.  These routines should not be called directly;
34  * they are called by code generated by the compiler.  Their declarations
35  * are here for kmdb's hdr2map and map2linktest mechanisms.
36  */
37 
38 #if !defined(__amd64)
39 
40 #ifdef __cplusplus
41 extern "C" {
42 #endif
43 
44 extern int64_t __mul64(int64_t a, int64_t b);
45 
46 extern uint64_t __udiv64(uint64_t x, uint64_t y);
47 extern uint64_t __urem64(uint64_t x, uint64_t y);
48 extern int64_t __div64(int64_t x, int64_t y);
49 extern int64_t __rem64(int64_t x, int64_t y);
50 
51 extern uint64_t __udivdi3(uint64_t a, uint64_t b);
52 extern uint64_t __umoddi3(uint64_t a, uint64_t b);
53 extern int64_t __divdi3(int64_t a, int64_t b);
54 extern int64_t __moddi3(int64_t a, int64_t b);
55 
56 extern uint64_t __udivrem64(uint64_t x, uint64_t y);
57 extern int64_t __divrem64(int64_t x, int64_t y);
58 
59 #ifdef __cplusplus
60 }
61 #endif
62 
63 #endif /* !defined(amd64) */
64 
65 #endif /* _MULDIV_H */
66