File tree 2 files changed +23
-24
lines changed 2 files changed +23
-24
lines changed Original file line number Diff line number Diff line change @@ -15,8 +15,6 @@ package maphash
15
15
import (
16
16
"hash"
17
17
"internal/abi"
18
- "internal/byteorder"
19
- "math"
20
18
)
21
19
22
20
// A Seed is a random value that selects the specific hash function
@@ -310,25 +308,3 @@ func WriteComparable[T comparable](h *Hash, x T) {
310
308
}
311
309
writeComparable (h , x )
312
310
}
313
-
314
- func (h * Hash ) float64 (f float64 ) {
315
- if f == 0 {
316
- h .WriteByte (0 )
317
- return
318
- }
319
- var buf [8 ]byte
320
- if f != f {
321
- byteorder .LEPutUint64 (buf [:], randUint64 ())
322
- h .Write (buf [:])
323
- return
324
- }
325
- byteorder .LEPutUint64 (buf [:], math .Float64bits (f ))
326
- h .Write (buf [:])
327
- }
328
-
329
- func btoi (b bool ) byte {
330
- if b {
331
- return 1
332
- }
333
- return 0
334
- }
Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ import (
10
10
"crypto/rand"
11
11
"errors"
12
12
"internal/byteorder"
13
+ "math"
13
14
"math/bits"
14
15
"reflect"
15
16
)
@@ -175,3 +176,25 @@ func appendT(h *Hash, v reflect.Value) {
175
176
}
176
177
panic (errors .New ("maphash: hash of unhashable type " + v .Type ().String ()))
177
178
}
179
+
180
+ func (h * Hash ) float64 (f float64 ) {
181
+ if f == 0 {
182
+ h .WriteByte (0 )
183
+ return
184
+ }
185
+ var buf [8 ]byte
186
+ if f != f {
187
+ byteorder .LEPutUint64 (buf [:], randUint64 ())
188
+ h .Write (buf [:])
189
+ return
190
+ }
191
+ byteorder .LEPutUint64 (buf [:], math .Float64bits (f ))
192
+ h .Write (buf [:])
193
+ }
194
+
195
+ func btoi (b bool ) byte {
196
+ if b {
197
+ return 1
198
+ }
199
+ return 0
200
+ }
You can’t perform that action at this time.
0 commit comments