Nick Kledzik | 7784be3 | 2011-03-17 00:09:13 +0000 | [diff] [blame] | 1 | /*===-- udivmodsi4.c - Implement __udivmodsi4 ------------------------------=== |
| 2 | * |
Chandler Carruth | 9d304d2 | 2019-01-19 10:56:40 +0000 | [diff] [blame^] | 3 | * 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 Kledzik | 7784be3 | 2011-03-17 00:09:13 +0000 | [diff] [blame] | 6 | * |
| 7 | * ===----------------------------------------------------------------------=== |
| 8 | * |
| 9 | * This file implements __udivmodsi4 for the compiler_rt library. |
| 10 | * |
| 11 | * ===----------------------------------------------------------------------=== |
| 12 | */ |
| 13 | |
| 14 | #include "int_lib.h" |
| 15 | |
Nick Kledzik | 7784be3 | 2011-03-17 00:09:13 +0000 | [diff] [blame] | 16 | /* Returns: a / b, *rem = a % b */ |
| 17 | |
Anton Korobeynikov | 498119c | 2011-04-19 17:52:09 +0000 | [diff] [blame] | 18 | COMPILER_RT_ABI su_int |
Nick Kledzik | 7784be3 | 2011-03-17 00:09:13 +0000 | [diff] [blame] | 19 | __udivmodsi4(su_int a, su_int b, su_int* rem) |
| 20 | { |
| 21 | si_int d = __udivsi3(a,b); |
| 22 | *rem = a - (d*b); |
Anton Korobeynikov | 498119c | 2011-04-19 17:52:09 +0000 | [diff] [blame] | 23 | return d; |
Nick Kledzik | 7784be3 | 2011-03-17 00:09:13 +0000 | [diff] [blame] | 24 | } |
| 25 | |
| 26 | |