//===-- udivmodti4.c - Implement __udivmodti4 -----------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // // This file implements __udivmodti4 for the compiler_rt library. // //===----------------------------------------------------------------------===// #include "int_lib.h" #ifdef CRT_HAS_128BIT // Returns the 128 bit division result by 64 bit. Result must fit in 64 bits. // Remainder stored in r. // Taken and adjusted from libdivide libdivide_128_div_64_to_64 division // fallback. For a correctness proof see the reference for this algorithm // in Knuth, Volume 2, section 4.3.1, Algorithm D. UNUSED static inline du_int udiv128by64to64default(du_int u1, du_int u0, du_int v, du_int *r) { … } static inline du_int udiv128by64to64(du_int u1, du_int u0, du_int v, du_int *r) { … } // Effects: if rem != 0, *rem = a % b // Returns: a / b COMPILER_RT_ABI tu_int __udivmodti4(tu_int a, tu_int b, tu_int *rem) { … } #endif // CRT_HAS_128BIT