File tree Expand file tree Collapse file tree 2 files changed +8
-0
lines changed Expand file tree Collapse file tree 2 files changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -132,7 +132,11 @@ public struct StaticString
132
132
var buffer : UInt64 = 0
133
133
var i = 0
134
134
let sink : ( UInt8 ) -> Void = {
135
+ #if _endian(little)
135
136
buffer = buffer | ( UInt64 ( $0) << ( UInt64 ( i) * 8 ) )
137
+ #else
138
+ buffer = buffer | ( UInt64 ( $0) << ( UInt64 ( 7 - i) * 8 ) )
139
+ #endif
136
140
i += 1
137
141
}
138
142
UTF8 . encode ( unicodeScalar, into: sink)
Original file line number Diff line number Diff line change @@ -299,8 +299,12 @@ public struct _StringCore {
299
299
// Always dereference two bytes, but when elements are 8 bits we
300
300
// multiply the high byte by 0.
301
301
// FIXME(performance): use masking instead of multiplication.
302
+ #if _endian(little)
302
303
return UTF16 . CodeUnit ( p. pointee)
303
304
+ UTF16. CodeUnit ( ( p + 1 ) . pointee) * _highByteMultiplier
305
+ #else
306
+ return _highByteMultiplier == 0 ? UTF16 . CodeUnit ( p. pointee) : UTF16 . CodeUnit ( ( p + 1 ) . pointee) + UTF16. CodeUnit ( p. pointee) * _highByteMultiplier
307
+ #endif
304
308
}
305
309
306
310
/// Get the Nth UTF-16 Code Unit stored.
You can’t perform that action at this time.
0 commit comments