Skip to content

Commit

Permalink
deps: V8: cherry-pick 0b3a4ecf7083
Browse files Browse the repository at this point in the history
Original commit message:

    Fix implicit conversion loses integer precision warning

    The type of m is long in 64 bits build, and results implicit conversion
    loses integer precision, which was found by improved clang warning
    (-Wshorten-64-to-32)

    Bug: chromium:1124085
    Change-Id: Ic9f22508bd817a06d5c90162b1ac3554a7171529
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2391323
    Commit-Queue: Zequan Wu <zequanwu@google.com>
    Auto-Submit: Zequan Wu <zequanwu@google.com>
    Reviewed-by: Nico Weber <thakis@chromium.org>
    Reviewed-by: Igor Sheludko <ishell@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#69686}

Refs: v8/v8@0b3a4ec

PR-URL: #39245
Refs: nodejs/build#2696
Reviewed-By: Richard Lau <rlau@redhat.com>
  • Loading branch information
targos authored and richardlau committed Jul 23, 2021
1 parent f4377b1 commit 8046daf
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion common.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

# Reset this number to 0 on major V8 upgrades.
# Increment by one for each non-official patch applied to deps/v8.
'v8_embedder_string': '-node.53',
'v8_embedder_string': '-node.54',

##### V8 defaults for Node.js #####

Expand Down
4 changes: 2 additions & 2 deletions deps/v8/src/base/macros.h
Original file line number Diff line number Diff line change
Expand Up @@ -357,14 +357,14 @@ inline T RoundDown(T x, intptr_t m) {
STATIC_ASSERT(std::is_integral<T>::value);
// m must be a power of two.
DCHECK(m != 0 && ((m & (m - 1)) == 0));
return x & -m;
return x & static_cast<T>(-m);
}
template <intptr_t m, typename T>
constexpr inline T RoundDown(T x) {
STATIC_ASSERT(std::is_integral<T>::value);
// m must be a power of two.
STATIC_ASSERT(m != 0 && ((m & (m - 1)) == 0));
return x & -m;
return x & static_cast<T>(-m);
}

// Return the smallest multiple of m which is >= x.
Expand Down

0 comments on commit 8046daf

Please sign in to comment.