1//===-- RoundingModeUtils.h -------------------------------------*- C++ -*-===//
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#ifndef LLVM_LIBC_TEST_UNITTEST_ROUNDINGMODEUTILS_H
10#define LLVM_LIBC_TEST_UNITTEST_ROUNDINGMODEUTILS_H
11
12#include "src/__support/macros/config.h"
13#include <stdint.h>
14
15namespace LIBC_NAMESPACE_DECL {
16namespace fputil {
17namespace testing {
18
19enum class RoundingMode : uint8_t { Upward, Downward, TowardZero, Nearest };
20
21struct ForceRoundingMode {
22 ForceRoundingMode(RoundingMode);
23 ~ForceRoundingMode();
24
25 int old_rounding_mode;
26 int rounding_mode;
27 bool success;
28};
29
30template <RoundingMode R> struct ForceRoundingModeTest : ForceRoundingMode {
31 ForceRoundingModeTest() : ForceRoundingMode(R) {}
32};
33
34} // namespace testing
35} // namespace fputil
36} // namespace LIBC_NAMESPACE_DECL
37
38#endif // LLVM_LIBC_TEST_UNITTEST_ROUNDINGMODEUTILS_H
39

source code of libc/test/UnitTest/RoundingModeUtils.h