diff --git a/src/common/u128.h b/src/common/u128.h index 401c608f..867ac1dd 100644 --- a/src/common/u128.h +++ b/src/common/u128.h @@ -24,7 +24,7 @@ struct u128 { u128(u64 lower_, u64 upper_) : lower(lower_), upper(upper_) {} - template + template /* implicit */ u128(T value) : lower(value), upper(0) { static_assert(std::is_integral_v); static_assert(Common::BitSize() <= Common::BitSize()); @@ -32,6 +32,16 @@ struct u128 { u64 lower = 0; u64 upper = 0; + + template + bool Bit() { + static_assert(bit_position < 128); + if constexpr (bit_position < 64) { + return Common::Bit(lower); + } else { + return Common::Bit(upper); + } + } }; static_assert(Common::BitSize() == 128);