Skip to content

Commit efe666e

Browse files
add constexpr to some ifs
1 parent 76abe95 commit efe666e

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

libc/src/__support/big_int.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,7 @@ struct BigInt {
373373
static_assert(
374374
(WORD_SIZE % BigIntOther::WORD_SIZE) == 0 &&
375375
"Word types must be multiples of each other for correct conversion.");
376-
if (OtherBits >= Bits) { // truncate
376+
if constexpr (OtherBits >= Bits) { // truncate
377377
// for each big word
378378
for (size_t i = 0; i < WORD_COUNT; ++i) {
379379
WordType cur_word = 0;
@@ -412,7 +412,7 @@ struct BigInt {
412412
extend((i / WORD_SIZE_RATIO) + 1, should_sign_extend);
413413
}
414414
} else if constexpr (BigIntOther::WORD_SIZE == WORD_SIZE) {
415-
if (OtherBits >= Bits) { // truncate
415+
if constexpr (OtherBits >= Bits) { // truncate
416416
for (size_t i = 0; i < WORD_COUNT; ++i)
417417
val[i] = other[i];
418418
} else { // zero or sign extend
@@ -427,7 +427,7 @@ struct BigInt {
427427
static_assert(
428428
(BigIntOther::WORD_SIZE % WORD_SIZE) == 0 &&
429429
"Word types must be multiples of each other for correct conversion.");
430-
if (OtherBits >= Bits) { // truncate
430+
if constexpr (OtherBits >= Bits) { // truncate
431431
// for each small word
432432
for (size_t i = 0; i < WORD_COUNT; ++i) {
433433
// split each big word into WORD_SIZE_RATIO small words

0 commit comments

Comments
 (0)