Small fixes (#4957)

This commit is contained in:
Guillaume Chatelet
2025-12-17 20:09:35 +01:00
committed by Corentin Le Molgat
parent 29a2cbf0a7
commit b8b9a5170a
2 changed files with 14 additions and 7 deletions

View File

@@ -13,6 +13,10 @@
#include "ortools/linear_solver/glop_utils.h"
#include "absl/log/log.h"
#include "ortools/linear_solver/linear_solver.h"
#include "ortools/lp_data/lp_types.h"
namespace operations_research {
MPSolver::ResultStatus GlopToMPSolverResultStatus(glop::ProblemStatus s) {

View File

@@ -240,18 +240,21 @@ namespace {
// - improve performance.
// - use vectorized code.
namespace internal {
uint32_t RawBits(uint32_t x) { return x; } // NOLINT
uint32_t RawBits(int x) { return absl::bit_cast<uint32_t>(x); } // NOLINT
uint32_t RawBits(float x) { return absl::bit_cast<uint32_t>(x); } // NOLINT
uint64_t RawBits(uint64_t x) { return x; } // NOLINT
uint64_t RawBits(int64_t x) { return absl::bit_cast<uint64_t>(x); } // NOLINT
uint64_t RawBits(double x) { return absl::bit_cast<uint64_t>(x); } // NOLINT
template <typename T>
auto RawBits(T x) {
if constexpr (sizeof(T) == sizeof(uint32_t)) {
return absl::bit_cast<uint32_t>(x);
} else {
static_assert(sizeof(T) == sizeof(uint64_t));
return absl::bit_cast<uint64_t>(x);
}
}
inline uint32_t Bucket(uint32_t x, uint32_t shift, uint32_t radix) {
DCHECK_EQ(0, radix & (radix - 1)); // Must be a power of two.
// NOMUTANTS -- a way to compute the remainder of a division when radix is a
// power of two.
return (RawBits(x) >> shift) & (radix - 1);
return (x >> shift) & (radix - 1);
}
template <typename T>