GCC Code Coverage Report
Directory: . Exec Total Coverage
File: src/util/roundingmode.h Lines: 1 1 100.0 %
Date: 2021-05-22 Branches: 0 0 0.0 %

Line Exec Source
1
/******************************************************************************
2
 * Top contributors (to current version):
3
 *   Aina Niemetz, Mathias Preiner, Martin Brain
4
 *
5
 * This file is part of the cvc5 project.
6
 *
7
 * Copyright (c) 2009-2021 by the authors listed in the file AUTHORS
8
 * in the top-level source directory and their institutional affiliations.
9
 * All rights reserved.  See the file COPYING in the top-level source
10
 * directory for licensing information.
11
 * ****************************************************************************
12
 *
13
 * The definition of rounding mode values.
14
 */
15
#include "cvc5_public.h"
16
17
#ifndef CVC5__ROUNDINGMODE_H
18
#define CVC5__ROUNDINGMODE_H
19
20
#include <fenv.h>
21
22
namespace cvc5 {
23
24
#define CVC5_NUM_ROUNDING_MODES 5
25
26
/**
27
 * A concrete instance of the rounding mode sort
28
 */
29
enum RoundingMode
30
{
31
  ROUND_NEAREST_TIES_TO_EVEN = FE_TONEAREST,
32
  ROUND_TOWARD_POSITIVE = FE_UPWARD,
33
  ROUND_TOWARD_NEGATIVE = FE_DOWNWARD,
34
  ROUND_TOWARD_ZERO = FE_TOWARDZERO,
35
  // Initializes this to the diagonalization of the 4 other values.
36
  ROUND_NEAREST_TIES_TO_AWAY =
37
      (((~FE_TONEAREST) & 0x1) | ((~FE_UPWARD) & 0x2) | ((~FE_DOWNWARD) & 0x4)
38
       | ((~FE_TOWARDZERO) & 0x8))
39
}; /* enum RoundingMode */
40
41
/**
42
 * Hash function for rounding mode values.
43
 */
44
struct RoundingModeHashFunction
45
{
46
91997
  inline size_t operator()(const RoundingMode& rm) const { return size_t(rm); }
47
}; /* struct RoundingModeHashFunction */
48
49
}  // namespace cvc5
50
51
#endif