divmodsi4.c revision 229135
150476Speter/*===-- divmodsi4.c - Implement __divmodsi4 --------------------------------===
232213Swosch *
319477Sjoerg *                    The LLVM Compiler Infrastructure
43077Sache *
53077Sache * This file is dual licensed under the MIT and the University of Illinois Open
632213Swosch * Source Licenses. See LICENSE.TXT for details.
73081Sache *
83077Sache * ===----------------------------------------------------------------------===
93077Sache *
103077Sache * This file implements __divmodsi4 for the compiler_rt library.
113077Sache *
123077Sache * ===----------------------------------------------------------------------===
1337463Sbde */
1437463Sbde
153077Sache#include "int_lib.h"
1632213Swosch
1732213Swoschextern COMPILER_RT_ABI si_int __divsi3(si_int a, si_int b);
183077Sache
193077Sache
203077Sache/* Returns: a / b, *rem = a % b  */
213077Sache
223077SacheCOMPILER_RT_ABI si_int
233077Sache__divmodsi4(si_int a, si_int b, si_int* rem)
243077Sache{
2538654Sjb  si_int d = __divsi3(a,b);
2637463Sbde  *rem = a - (d*b);
273077Sache  return d;
283077Sache}
29
30
31