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

Line Exec Source
1
/******************************************************************************
2
 * Top contributors (to current version):
3
 *   Yancheng Ou
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
 * Optimizer for BitVector type.
14
 */
15
16
#ifndef CVC5__OMT__BITVECTOR_OPTIMIZER_H
17
#define CVC5__OMT__BITVECTOR_OPTIMIZER_H
18
19
#include "omt/omt_optimizer.h"
20
21
namespace cvc5::omt {
22
23
/**
24
 * Optimizer for BitVector type
25
 */
26
class OMTOptimizerBitVector : public OMTOptimizer
27
{
28
 public:
29
  OMTOptimizerBitVector(bool isSigned);
30
20
  virtual ~OMTOptimizerBitVector() = default;
31
  smt::OptimizationResult minimize(SmtEngine* optChecker,
32
                                   TNode target) override;
33
  smt::OptimizationResult maximize(SmtEngine* optChecker,
34
                                   TNode target) override;
35
36
 private:
37
  /**
38
   * Computes the BitVector version of (a + b) / 2 without overflow,
39
   * rounding towards -infinity: -1.5 --> -2 and 1.5 --> 1
40
   * same as the rounding scheme for int32_t
41
   **/
42
  BitVector computeAverage(const BitVector& a,
43
                           const BitVector& b,
44
                           bool isSigned);
45
  /** Is the BitVector doing signed comparison? **/
46
  bool d_isSigned;
47
};
48
49
}  // namespace cvc5::omt
50
51
#endif /* CVC5__OMT__BITVECTOR_OPTIMIZER_H */