@@ -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
@@ -317,7 +319,9 @@ extension _SmallString {
317
319
#endif
318
320
319
321
extension UInt64 {
320
- // Fetches the `i`th byte, from left to right.
322
+ // Fetches the `i`th byte in memory order. On little-endian systems the byte
323
+ // at i=0 is the least significant byte (LSB) while on big-endian systems the
324
+ // byte at i=7 is the LSB.
321
325
@inlinable @inline ( __always)
322
326
internal func _uncheckedGetByte( at i: Int ) -> UInt8 {
323
327
_internalInvariant ( i >= 0 && i < MemoryLayout< UInt64> . stride)
@@ -329,7 +333,9 @@ extension UInt64 {
329
333
return UInt8 ( truncatingIfNeeded: ( self &>> shift) )
330
334
}
331
335
332
- // Sets the `i`th byte, from left to right.
336
+ // Sets the `i`th byte in memory order. On little-endian systems the byte
337
+ // at i=0 is the least significant byte (LSB) while on big-endian systems the
338
+ // byte at i=7 is the LSB.
333
339
@inlinable @inline ( __always)
334
340
internal mutating func _uncheckedSetByte( at i: Int , to value: UInt8 ) {
335
341
_internalInvariant ( i >= 0 && i < MemoryLayout< UInt64> . stride)
0 commit comments