diff --git a/Sources/BigInt/BigInt.swift b/Sources/BigInt/BigInt.swift index ea54a0b..b236864 100644 --- a/Sources/BigInt/BigInt.swift +++ b/Sources/BigInt/BigInt.swift @@ -379,6 +379,9 @@ extension BigInt: BinaryInteger { if source > 0 && source.words[source.words.endIndex - 1] > Int.max { words.append(0) } + // needed to handle sign-extended multi-word numbers that + // actually fit in a single word + BigInt._dropExcessWords(words: &words) } }