blob: 89199d92b94449cbd60642af166dd19aaa8d3c4a [file] [log] [blame]
Nick Kledzik7784be32011-03-17 00:09:13 +00001/*===-- udivmodsi4.c - Implement __udivmodsi4 ------------------------------===
2 *
Chandler Carruth9d304d22019-01-19 10:56:40 +00003 * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 * See https://llvm.org/LICENSE.txt for license information.
5 * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
Nick Kledzik7784be32011-03-17 00:09:13 +00006 *
7 * ===----------------------------------------------------------------------===
8 *
9 * This file implements __udivmodsi4 for the compiler_rt library.
10 *
11 * ===----------------------------------------------------------------------===
12 */
13
14#include "int_lib.h"
15
Nick Kledzik7784be32011-03-17 00:09:13 +000016/* Returns: a / b, *rem = a % b */
17
Anton Korobeynikov498119c2011-04-19 17:52:09 +000018COMPILER_RT_ABI su_int
Nick Kledzik7784be32011-03-17 00:09:13 +000019__udivmodsi4(su_int a, su_int b, su_int* rem)
20{
21 si_int d = __udivsi3(a,b);
22 *rem = a - (d*b);
Anton Korobeynikov498119c2011-04-19 17:52:09 +000023 return d;
Nick Kledzik7784be32011-03-17 00:09:13 +000024}
25
26