* * @notes: 重写一遍是为了防止环状引用 */
(s string)
| 33 | * @notes: 重写一遍是为了防止环状引用 |
| 34 | */ |
| 35 | func str2sbyte(s string) (b []byte) { |
| 36 | *(*string)(unsafe.Pointer(&b)) = s // 把s的地址付给b |
| 37 | *(*int)(unsafe.Pointer(uintptr(unsafe.Pointer(&b)) + 2*unsafe.Sizeof(&b))) = len(s) // 修改容量为长度 |
| 38 | return |
| 39 | } |
| 40 | |
| 41 | // TODO 桶的数量应该可以自己配置,因为xxhash的性能很优秀,所以越大的数据越适合更多的桶 |
| 42 | var SHARD_COUNT = 32 |
no outgoing calls
no test coverage detected