]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm-project/compiler-rt/lib/builtins/divmoddi4.c
Merge ^/head r358131 through r358178.
[FreeBSD/FreeBSD.git] / contrib / llvm-project / compiler-rt / lib / builtins / divmoddi4.c
1 //===-- divmoddi4.c - Implement __divmoddi4 -------------------------------===//
2 //
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
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This file implements __divmoddi4 for the compiler_rt library.
10 //
11 //===----------------------------------------------------------------------===//
12
13 #include "int_lib.h"
14
15 // Returns: a / b, *rem = a % b
16
17 COMPILER_RT_ABI di_int __divmoddi4(di_int a, di_int b, di_int *rem) {
18   di_int d = __divdi3(a, b);
19   *rem = a - (d * b);
20   return d;
21 }