Skip to content

Commit 3d53b49

Browse files
committed
remove unused code
1 parent 8147434 commit 3d53b49

2 files changed

Lines changed: 0 additions & 43 deletions

File tree

ortools/util/fp_utils.cc

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
#include <vector>
2626

2727
#include "absl/base/casts.h"
28-
#include "absl/base/internal/endian.h"
2928
#include "absl/log/check.h"
3029
#include "absl/types/span.h"
3130
#include "ortools/util/bitset.h"
@@ -230,33 +229,4 @@ int64_t ComputeGcdOfRoundedDoubles(absl::Span<const double> x,
230229
return gcd > 0 ? gcd : 1;
231230
}
232231

233-
int fast_ilogb(double value) {
234-
static_assert(CHAR_BIT == 8);
235-
static_assert(sizeof(double) == 8);
236-
// Get little-endian bit-representation of the floating point value.
237-
const uint64_t bit_rep =
238-
absl::little_endian::FromHost64(absl::bit_cast<uint64_t>(value));
239-
return static_cast<int>((bit_rep >> 52) & 0x7FF) - 1023;
240-
}
241-
242-
void fast_scalbn_inplace(double& mutable_value, int exponent) {
243-
mutable_value = fast_scalbn(mutable_value, exponent);
244-
}
245-
246-
double fast_scalbn(double value, int exponent) {
247-
if (value == 0.0) return 0.0;
248-
uint64_t bit_rep =
249-
absl::little_endian::FromHost64(absl::bit_cast<uint64_t>(value));
250-
// Binary representation is: (sign-bit)(11 exponent bits)(52 mantissa bits)
251-
constexpr uint64_t kExponentMask(0x7FF0000000000000);
252-
// This addition relies on the fact that signed numbers are written in
253-
// two-s complement, and is correct as long as the sum does not
254-
// overflow/underflow the result.
255-
const uint64_t value_exponent =
256-
(bit_rep + (static_cast<uint64_t>(exponent) << 52)) & kExponentMask;
257-
bit_rep &= ~kExponentMask;
258-
bit_rep |= value_exponent;
259-
return absl::bit_cast<double>(absl::little_endian::ToHost64(bit_rep));
260-
}
261-
262232
} // namespace operations_research

ortools/util/fp_utils.h

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -253,19 +253,6 @@ inline FloatType Interpolate(FloatType x, FloatType y, FloatType alpha) {
253253
return alpha * x + (1 - alpha) * y;
254254
}
255255

256-
// This is a fast implementation of the C99 function ilogb for normalized
257-
// doubles with the caveat that it returns -1023 for zero, and 1024 for infinity
258-
// an NaNs.
259-
int fast_ilogb(double value);
260-
261-
// This is a fast implementation of the C99 function scalbn, with the caveat
262-
// that it works on normalized numbers and if the result underflows, overflows,
263-
// or is applied to a NaN or an +-infinity, the result is undefined behavior.
264-
// Note that the version of the function that takes a reference, modifies the
265-
// given value.
266-
double fast_scalbn(double value, int exponent);
267-
void fast_scalbn_inplace(double& mutable_value, int exponent);
268-
269256
} // namespace operations_research
270257

271258
#endif // OR_TOOLS_UTIL_FP_UTILS_H_

0 commit comments

Comments
 (0)