tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit 62b58fd619a015ade02c0aca05c680605bfc154a
parent fcc54317e999f33cbfd2b84dc99d2490a0adfddb
Author: André Bargull <andre.bargull@gmail.com>
Date:   Thu, 13 Nov 2025 09:02:19 +0000

Bug 1999492 - Part 2: Add more constructors to Int128. r=iain

These are needed for `ReciprocalMulConstants`.

Differential Revision: https://phabricator.services.mozilla.com/D272137

Diffstat:
Mjs/src/vm/Int128.h | 12++++++++++++
1 file changed, 12 insertions(+), 0 deletions(-)

diff --git a/js/src/vm/Int128.h b/js/src/vm/Int128.h @@ -203,9 +203,15 @@ class alignas(16) Uint128 final { constexpr Uint128() = default; constexpr Uint128(const Uint128&) = default; + explicit constexpr Uint128(int64_t value) + : Uint128(uint64_t(value), uint64_t(value >> 63)) {} + explicit constexpr Uint128(uint64_t value) : Uint128(uint64_t(value), uint64_t(0)) {} + explicit constexpr Uint128(int32_t value) : Uint128(int64_t(value)) {} + explicit constexpr Uint128(uint32_t value) : Uint128(uint64_t(value)) {} + constexpr bool operator==(const Uint128& other) const { return low == other.low && high == other.high; } @@ -459,6 +465,12 @@ class alignas(16) Int128 final { explicit constexpr Int128(int64_t value) : Int128(uint64_t(value), uint64_t(value >> 63)) {} + explicit constexpr Int128(uint64_t value) + : Int128(uint64_t(value), uint64_t(0)) {} + + explicit constexpr Int128(int32_t value) : Int128(int64_t(value)) {} + explicit constexpr Int128(uint32_t value) : Int128(uint64_t(value)) {} + /** * Return the quotient and remainder of the division. */