[swift-evolution] [Idea] Large integer literals

Brent Royal-Gordon brent at architechies.com
Mon Jul 4 00:03:50 CDT 2016


> On Jul 3, 2016, at 9:20 PM, Brent Royal-Gordon <brent at architechies.com> wrote:
> 
> 			for i in 0 ..< countRepresentedWords {
> 				let word = value.word(at: i)
> 
> 				bits &<<= word.bitWidth
> 				bits |= Magnitude(truncatingOrExtending: word)
> 			}

Tangentially, I now realize that this was totally backwards. Should be more like:

			for i in 0 ..< countRepresentedWords {
				let word = value.word(at: i)
				let shift = i * word.bitWidth
				bits |= Magnitude(truncatingOrExtending: word) &<< shift
			}

Always fun when your dumb mistakes get sent to large numbers of people.

-- 
Brent Royal-Gordon
Architechies



More information about the swift-evolution mailing list