/
GitCaptain
/
llvm-project
Обзор
Документация
Войти
/
GitCaptain
/
llvm-project
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
fix-tests
libc/src/__support/integer_operations.h
31 строка
897 B
Michael Jones
[libc] apply new lint rules
07 дек 2021, 21:49
07 дек 2021, 21:49
1c92911
Код
Авторство
О чём код?
//===-- Utils for abs and friends -------------------------------*- C++ -*-===// // // 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 // //===----------------------------------------------------------------------===// #ifndef LLVM_LIBC_SRC_STDLIB_ABS_UTILS_H #define LLVM_LIBC_SRC_STDLIB_ABS_UTILS_H #include "src/__support/CPP/TypeTraits.h" namespace __llvm_libc { template <typename T> static constexpr cpp::EnableIfType<cpp::IsIntegral<T>::Value, T> integer_abs(T n) { return (n < 0) ? -n : n; } template <typename T> static constexpr cpp::EnableIfType<cpp::IsIntegral<T>::Value, void> integer_rem_quo(T x, T y, T ", T &rem) { quot = x / y; rem = x % y; } } // namespace __llvm_libc #endif // LLVM_LIBC_SRC_STDLIB_ABS_UTILS_H