Skip to content

Commit dd3fb9b

Browse files
author
Dave Abrahams
committed
[stdlib] Small correction to UTF8 Iterator
This works either way I suppose, but the code is clearer now.
1 parent 73f116e commit dd3fb9b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

stdlib/public/core/StringUTF8.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -455,7 +455,7 @@ extension String.UTF8View.Iterator : IteratorProtocol {
455455
while _sourceIndex != _source.endIndex && shift < _OutputBuffer.bitWidth {
456456
let u = _source[_sourceIndex]
457457
if u >= 0x80 { break }
458-
_buffer |= _OutputBuffer(u &+ 1) &<< shift
458+
_buffer |= _OutputBuffer(UInt8(extendingOrTruncating: u &+ 1)) &<< shift
459459
_sourceIndex += 1
460460
shift = shift &+ 8
461461
}

0 commit comments

Comments
 (0)