MCPcopy Create free account
hub / github.com/Super-long/ChubbyGo / str2sbyte

Function str2sbyte

BaseServer/concurrentHashMap.go:35–39  ·  view source on GitHub ↗

* * @notes: 重写一遍是为了防止环状引用 */

(s string)

Source from the content-addressed store, hash-verified

33 * @notes: 重写一遍是为了防止环状引用
34 */
35func 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的性能很优秀,所以越大的数据越适合更多的桶
42var SHARD_COUNT = 32

Callers 2

InsertMethod · 0.85
xxhash_keyFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected