File tree Expand file tree Collapse file tree 1 file changed +2
-22
lines changed
Expand file tree Collapse file tree 1 file changed +2
-22
lines changed Original file line number Diff line number Diff line change @@ -15,23 +15,6 @@ import (
1515 "unsafe"
1616)
1717
18- func ptrToSlice (ptr unsafe.Pointer , n uintptr ) []byte {
19- var p []byte
20-
21- type _bslice struct {
22- ptr * byte
23- len uintptr
24- cap uintptr
25- }
26-
27- pslice := (* _bslice )(unsafe .Pointer (& p ))
28- pslice .ptr = (* byte )(ptr )
29- pslice .cap = n
30- pslice .len = n
31-
32- return p
33- }
34-
3518type sip struct {
3619 v0 , v1 uint64
3720}
@@ -45,8 +28,7 @@ func (s *sip) round() {
4528}
4629
4730func hash64 (ptr unsafe.Pointer , n uintptr , seed uintptr ) uint64 {
48-
49- p := ptrToSlice (ptr , n )
31+ p := unsafe .Slice ((* byte )(ptr ), n )
5032
5133 k0 := uint64 (seed )
5234 k1 := uint64 (0 )
@@ -117,9 +99,7 @@ func (s *sip32) round() {
11799}
118100
119101func hash32 (ptr unsafe.Pointer , n uintptr , seed uintptr ) uint32 {
120- // TODO(dgryski): replace this messiness with unsafe.Slice when we can use 1.17 features
121-
122- p := ptrToSlice (ptr , n )
102+ p := unsafe .Slice ((* byte )(ptr ), n )
123103
124104 k0 := uint32 (seed )
125105 k1 := uint32 (seed >> 32 )
You can’t perform that action at this time.
0 commit comments