OLD | NEW |
---|---|
1 //===- subzero/src/IceUtils.h - Utility functions ---------------*- C++ -*-===// | 1 //===- subzero/src/IceUtils.h - Utility functions ---------------*- C++ -*-===// |
2 // | 2 // |
3 // The Subzero Code Generator | 3 // The Subzero Code Generator |
4 // | 4 // |
5 // This file is distributed under the University of Illinois Open Source | 5 // This file is distributed under the University of Illinois Open Source |
6 // License. See LICENSE.TXT for details. | 6 // License. See LICENSE.TXT for details. |
7 // | 7 // |
8 //===----------------------------------------------------------------------===// | 8 //===----------------------------------------------------------------------===// |
9 /// | 9 /// |
10 /// \file | 10 /// \file |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
116 return (value >> shift) | (value << (32 - shift)); | 116 return (value >> shift) | (value << (32 - shift)); |
117 } | 117 } |
118 | 118 |
119 /// Returns true if Val is +0.0. It requires T to be a floating point type. | 119 /// Returns true if Val is +0.0. It requires T to be a floating point type. |
120 template <typename T> static bool isPositiveZero(T Val) { | 120 template <typename T> static bool isPositiveZero(T Val) { |
121 static_assert(std::is_floating_point<T>::value, | 121 static_assert(std::is_floating_point<T>::value, |
122 "Input type must be floating point"); | 122 "Input type must be floating point"); |
123 return Val == 0 && !std::signbit(Val); | 123 return Val == 0 && !std::signbit(Val); |
124 } | 124 } |
125 | 125 |
126 /// A helper class to ease the settings of RandomizationPoolingPause to disable | |
Jim Stichnoth
2016/02/12 22:41:31
This comment is now completely wrong. :)
| |
127 /// constant blinding or pooling for some translation phases. | |
128 class BoolFlagSaver { | |
129 BoolFlagSaver() = delete; | |
130 BoolFlagSaver(const BoolFlagSaver &) = delete; | |
131 BoolFlagSaver &operator=(const BoolFlagSaver &) = delete; | |
132 | |
133 public: | |
134 BoolFlagSaver(bool &F, bool NewValue) : OldValue(F), Flag(F) { F = NewValue; } | |
135 ~BoolFlagSaver() { Flag = OldValue; } | |
136 | |
137 private: | |
138 const bool OldValue; | |
139 bool &Flag; | |
140 }; | |
141 | |
126 } // end of namespace Utils | 142 } // end of namespace Utils |
127 } // end of namespace Ice | 143 } // end of namespace Ice |
128 | 144 |
129 #endif // SUBZERO_SRC_ICEUTILS_H | 145 #endif // SUBZERO_SRC_ICEUTILS_H |
OLD | NEW |