xref: /llvm-project/libc/src/stdlib/div.cpp (revision 5ff3ff33ff930e4ec49da7910612d8a41eb068cb)
174670e79SSiva Chandra Reddy //===-- Implementation of div ---------------------------------------------===//
274670e79SSiva Chandra Reddy //
374670e79SSiva Chandra Reddy // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
474670e79SSiva Chandra Reddy // See https://llvm.org/LICENSE.txt for license information.
574670e79SSiva Chandra Reddy // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
674670e79SSiva Chandra Reddy //
774670e79SSiva Chandra Reddy //===----------------------------------------------------------------------===//
874670e79SSiva Chandra Reddy 
974670e79SSiva Chandra Reddy #include "src/stdlib/div.h"
1074670e79SSiva Chandra Reddy #include "src/__support/common.h"
1174670e79SSiva Chandra Reddy #include "src/__support/integer_operations.h"
12*5ff3ff33SPetr Hosek #include "src/__support/macros/config.h"
1374670e79SSiva Chandra Reddy 
14*5ff3ff33SPetr Hosek namespace LIBC_NAMESPACE_DECL {
1574670e79SSiva Chandra Reddy 
1674670e79SSiva Chandra Reddy LLVM_LIBC_FUNCTION(div_t, div, (int x, int y)) {
1774670e79SSiva Chandra Reddy   div_t res;
181c92911eSMichael Jones   integer_rem_quo(x, y, res.quot, res.rem);
1974670e79SSiva Chandra Reddy   return res;
2074670e79SSiva Chandra Reddy }
2174670e79SSiva Chandra Reddy 
22*5ff3ff33SPetr Hosek } // namespace LIBC_NAMESPACE_DECL
23