Skip to content

Commit 84b0c39

Browse files
add static assert guard.
1 parent efe666e commit 84b0c39

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

libc/src/__support/big_int.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -367,6 +367,10 @@ struct BigInt {
367367
using BigIntOther = BigInt<OtherBits, OtherSigned, OtherWordType>;
368368
const bool should_sign_extend = Signed && other.is_neg();
369369

370+
static_assert(!(Bits == OtherBits && WORD_SIZE != BigIntOther::WORD_SIZE) &&
371+
"This is currently untested for casting between bigints with "
372+
"the same bit width but different word sizes.");
373+
370374
if constexpr (BigIntOther::WORD_SIZE < WORD_SIZE) {
371375
// OtherWordType is smaller
372376
constexpr size_t WORD_SIZE_RATIO = WORD_SIZE / BigIntOther::WORD_SIZE;

0 commit comments

Comments
 (0)