From aaeb9029e920a1eb4fca4a5cddf81dfa0286b1f2 Mon Sep 17 00:00:00 2001 From: Robert Thompson Date: Wed, 29 Jan 2020 10:42:52 -0500 Subject: [PATCH] Another fix for conversion of multi-word Ints --- Sources/BigInt/BigInt.swift | 3 +++ 1 file changed, 3 insertions(+) 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) } }