You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// **NOTE**: this uses `count` (an Int) and NOT `length` (a UInt8)
812
+
// Despite having the same value, they hash differently. InlineSlice and LargeSlice both use `count` (an Int); if you combine the same bytes but with `length` over `count`, you can get a different hash.
813
+
//
814
+
// This affects slices, which are InlineSlice and not InlineData:
815
+
//
816
+
// let d = Data([0xFF, 0xFF]) // InlineData
817
+
// let s = Data([0, 0xFF, 0xFF]).dropFirst() // InlineSlice
818
+
// assert(s == d)
819
+
// assert(s.hashValue == d.hashValue)
820
+
hasher.combine(count)
821
+
822
+
Swift.withUnsafeBytes(of: bytes){
823
+
// We have access to the full byte buffer here, but not all of it is meaningfully used (bytes past self.length may be garbage).
0 commit comments