1219719Sed/*===-- udivmodsi4.c - Implement __udivmodsi4 ------------------------------===
2219719Sed *
3219719Sed *                    The LLVM Compiler Infrastructure
4219719Sed *
5219719Sed * This file is dual licensed under the MIT and the University of Illinois Open
6219719Sed * Source Licenses. See LICENSE.TXT for details.
7219719Sed *
8219719Sed * ===----------------------------------------------------------------------===
9219719Sed *
10219719Sed * This file implements __udivmodsi4 for the compiler_rt library.
11219719Sed *
12219719Sed * ===----------------------------------------------------------------------===
13219719Sed */
14219719Sed
15219719Sed#include "int_lib.h"
16219719Sed
17222625Sedextern su_int COMPILER_RT_ABI __udivsi3(su_int n, su_int d);
18219719Sed
19219719Sed
20219719Sed/* Returns: a / b, *rem = a % b  */
21219719Sed
22222625SedCOMPILER_RT_ABI su_int
23219719Sed__udivmodsi4(su_int a, su_int b, su_int* rem)
24219719Sed{
25219719Sed  si_int d = __udivsi3(a,b);
26219719Sed  *rem = a - (d*b);
27222625Sed  return d;
28219719Sed}
29219719Sed
30219719Sed
31