xref: /illumos-gate/usr/src/common/util/i386/muldiv.h (revision c40a6cd7)
17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
57c478bd9Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
67c478bd9Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
77c478bd9Sstevel@tonic-gate  * with the License.
87c478bd9Sstevel@tonic-gate  *
97c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
107c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
117c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
127c478bd9Sstevel@tonic-gate  * and limitations under the License.
137c478bd9Sstevel@tonic-gate  *
147c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
157c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
167c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
177c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
187c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
197c478bd9Sstevel@tonic-gate  *
207c478bd9Sstevel@tonic-gate  * CDDL HEADER END
217c478bd9Sstevel@tonic-gate  */
22*89518a1cSdmick 
237c478bd9Sstevel@tonic-gate /*
24*89518a1cSdmick  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
257c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
267c478bd9Sstevel@tonic-gate  */
277c478bd9Sstevel@tonic-gate 
28*89518a1cSdmick #ifndef _MULDIV_H
29*89518a1cSdmick #define	_MULDIV_H
307c478bd9Sstevel@tonic-gate 
317c478bd9Sstevel@tonic-gate /*
32*89518a1cSdmick  * Helper routines for Sun and GCC compilers in 32-bit mode,
33*89518a1cSdmick  * doing 64-bit math.  These routines should not be called directly;
34*89518a1cSdmick  * they are called by code generated by the compiler.  Their declarations
35*89518a1cSdmick  * are here for kmdb's hdr2map and map2linktest mechanisms.
367c478bd9Sstevel@tonic-gate  */
377c478bd9Sstevel@tonic-gate 
38*89518a1cSdmick #if !defined(__amd64)
39*89518a1cSdmick 
407c478bd9Sstevel@tonic-gate #ifdef __cplusplus
417c478bd9Sstevel@tonic-gate extern "C" {
427c478bd9Sstevel@tonic-gate #endif
437c478bd9Sstevel@tonic-gate 
44*89518a1cSdmick extern int64_t __mul64(int64_t a, int64_t b);
45*89518a1cSdmick 
46*89518a1cSdmick extern uint64_t __udiv64(uint64_t x, uint64_t y);
47*89518a1cSdmick extern uint64_t __urem64(uint64_t x, uint64_t y);
48*89518a1cSdmick extern int64_t __div64(int64_t x, int64_t y);
49*89518a1cSdmick extern int64_t __rem64(int64_t x, int64_t y);
50*89518a1cSdmick 
51*89518a1cSdmick extern uint64_t __udivdi3(uint64_t a, uint64_t b);
52*89518a1cSdmick extern uint64_t __umoddi3(uint64_t a, uint64_t b);
53*89518a1cSdmick extern int64_t __divdi3(int64_t a, int64_t b);
54*89518a1cSdmick extern int64_t __moddi3(int64_t a, int64_t b);
55*89518a1cSdmick 
56*89518a1cSdmick extern uint64_t __udivrem64(uint64_t x, uint64_t y);
57*89518a1cSdmick extern int64_t __divrem64(int64_t x, int64_t y);
587c478bd9Sstevel@tonic-gate 
597c478bd9Sstevel@tonic-gate #ifdef __cplusplus
607c478bd9Sstevel@tonic-gate }
617c478bd9Sstevel@tonic-gate #endif
627c478bd9Sstevel@tonic-gate 
63*89518a1cSdmick #endif /* !defined(amd64) */
64*89518a1cSdmick 
65*89518a1cSdmick #endif /* _MULDIV_H */
66