@@ -87,9 +87,11 @@ extension _SmallString {
87
87
}
88
88
}
89
89
90
+ // Get an integer equivalent to the _StringObject.discriminatedObjectRawBits
91
+ // computed property.
90
92
@inlinable @inline ( __always)
91
93
internal var rawDiscriminatedObject : UInt64 {
92
- // Discriminator is the most significant byte .
94
+ // Reverse the bytes on big-endian systems .
93
95
return _storage. 1 . littleEndian
94
96
}
95
97
@@ -312,7 +314,9 @@ extension _SmallString {
312
314
#endif
313
315
314
316
extension UInt64 {
315
- // Fetches the `i`th byte, from left to right.
317
+ // Fetches the `i`th byte in memory order. On little-endian systems the byte
318
+ // at i=0 is the least significant byte (LSB) while on big-endian systems the
319
+ // byte at i=7 is the LSB.
316
320
@inlinable @inline ( __always)
317
321
internal func _uncheckedGetByte( at i: Int ) -> UInt8 {
318
322
_internalInvariant ( i >= 0 && i < MemoryLayout< UInt64> . stride)
@@ -324,7 +328,9 @@ extension UInt64 {
324
328
return UInt8 ( truncatingIfNeeded: ( self &>> shift) )
325
329
}
326
330
327
- // Sets the `i`th byte, from left to right.
331
+ // Sets the `i`th byte in memory order. On little-endian systems the byte
332
+ // at i=0 is the least significant byte (LSB) while on big-endian systems the
333
+ // byte at i=7 is the LSB.
328
334
@inlinable @inline ( __always)
329
335
internal mutating func _uncheckedSetByte( at i: Int , to value: UInt8 ) {
330
336
_internalInvariant ( i >= 0 && i < MemoryLayout< UInt64> . stride)
0 commit comments