Commit abebfa68 authored by Nico Hartmann's avatar Nico Hartmann Committed by V8 LUCI CQ

Revert "[Torque] Fix compile error in integer-literal.h"

This reverts commit 83bf6629.

Reason for revert: Have to revert dependent CL

Original change's description:
> [Torque] Fix compile error in integer-literal.h
>
> Bug: v8:7793
> Change-Id: I88e6ea24909ba1dde8cada90d7b195b6f6ecc783
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3400958
> Reviewed-by: Jakob Gruber <jgruber@chromium.org>
> Commit-Queue: Nico Hartmann <nicohartmann@chromium.org>
> Auto-Submit: Nico Hartmann <nicohartmann@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#78678}

Bug: v8:7793
Change-Id: I4e62d8d121c0585df15f47653c44569d0f6b5606
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3401597
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Reviewed-by: 's avatarNico Hartmann <nicohartmann@chromium.org>
Owners-Override: Nico Hartmann <nicohartmann@chromium.org>
Reviewed-by: 's avatarTobias Tebbi <tebbi@chromium.org>
Commit-Queue: Nico Hartmann <nicohartmann@chromium.org>
Cr-Commit-Position: refs/heads/main@{#78704}
parent 1d95b0b8
......@@ -12,15 +12,6 @@
namespace v8 {
namespace internal {
template <typename T, bool Safe>
struct Shifter {
static constexpr T shift_right(T value, T shift) { return value >> shift; }
};
template <typename T>
struct Shifter<T, false> {
static constexpr T shift_right(T value, T shift) { return T(0); }
};
class IntegerLiteral {
public:
using digit_t = bigint::digit_t;
......@@ -109,20 +100,19 @@ class IntegerLiteral {
explicit IntegerLiteral(T value, bool perform_dcheck) : sign_(false) {
static_assert(std::is_integral<T>::value, "Integral type required");
if (value == T(0)) return;
using unsigned_t = std::make_unsigned_t<T>;
auto absolute = static_cast<unsigned_t>(value);
auto absolute = static_cast<typename std::make_unsigned<T>::type>(value);
if (value < T(0)) {
sign_ = true;
absolute = (~absolute) + 1;
}
do {
digits_.push_back(static_cast<digit_t>(absolute));
absolute =
Shifter<unsigned_t, (sizeof(absolute) >
sizeof(digit_t))>::shift_right(absolute,
sizeof(digit_t) *
kBitsPerByte);
} while (absolute != 0);
if (sizeof(absolute) <= sizeof(digit_t)) {
digits_.push_back(absolute);
} else {
do {
digits_.push_back(static_cast<digit_t>(absolute));
absolute >>= sizeof(digit_t) * kBitsPerByte;
} while (absolute != 0);
}
if (perform_dcheck) DCHECK_EQ(To<T>(), value);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment