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

Line Exec Source
1
/*********************                                                        */
2
/*! \file roundingmode.h
3
 ** \verbatim
4
 ** Top contributors (to current version):
5
 **   Aina Niemetz, Martin Brain, Tim King
6
 ** This file is part of the CVC4 project.
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.\endverbatim
11
 **
12
 ** \brief The definition of rounding mode values.
13
 **/
14
#include "cvc4_public.h"
15
16
#ifndef CVC4__ROUNDINGMODE_H
17
#define CVC4__ROUNDINGMODE_H
18
19
#include <fenv.h>
20
21
namespace CVC4 {
22
23
#define CVC4_NUM_ROUNDING_MODES 5
24
25
/**
26
 * A concrete instance of the rounding mode sort
27
 */
28
enum RoundingMode
29
{
30
  ROUND_NEAREST_TIES_TO_EVEN = FE_TONEAREST,
31
  ROUND_TOWARD_POSITIVE = FE_UPWARD,
32
  ROUND_TOWARD_NEGATIVE = FE_DOWNWARD,
33
  ROUND_TOWARD_ZERO = FE_TOWARDZERO,
34
  // Initializes this to the diagonalization of the 4 other values.
35
  ROUND_NEAREST_TIES_TO_AWAY =
36
      (((~FE_TONEAREST) & 0x1) | ((~FE_UPWARD) & 0x2) | ((~FE_DOWNWARD) & 0x4)
37
       | ((~FE_TOWARDZERO) & 0x8))
38
}; /* enum RoundingMode */
39
40
/**
41
 * Hash function for rounding mode values.
42
 */
43
struct RoundingModeHashFunction
44
{
45
85777
  inline size_t operator()(const RoundingMode& rm) const { return size_t(rm); }
46
}; /* struct RoundingModeHashFunction */
47
48
}  // namespace CVC4
49
50
#endif