summaryrefslogtreecommitdiff
path: root/vendor/codeberg.org/gruf/go-structr/hash_48.go
diff options
context:
space:
mode:
authorLibravatar kim <89579420+NyaaaWhatsUpDoc@users.noreply.github.com>2024-01-29 15:13:53 +0000
committerLibravatar GitHub <noreply@github.com>2024-01-29 15:13:53 +0000
commit81198fa2d09f07bb54ec28f41b20f275e88a3254 (patch)
tree14f0d24168e085c50c27f6dadbe1fd71e63faca1 /vendor/codeberg.org/gruf/go-structr/hash_48.go
parent[bugfix] Fix Postgres emoji delete, emoji category change (#2570) (diff)
downloadgotosocial-81198fa2d09f07bb54ec28f41b20f275e88a3254.tar.xz
update go-structr v0.2.0 => v0.3.0 to fix possible hash collision issues (#2586)
Diffstat (limited to 'vendor/codeberg.org/gruf/go-structr/hash_48.go')
-rw-r--r--vendor/codeberg.org/gruf/go-structr/hash_48.go21
1 files changed, 21 insertions, 0 deletions
diff --git a/vendor/codeberg.org/gruf/go-structr/hash_48.go b/vendor/codeberg.org/gruf/go-structr/hash_48.go
new file mode 100644
index 000000000..df4209e2f
--- /dev/null
+++ b/vendor/codeberg.org/gruf/go-structr/hash_48.go
@@ -0,0 +1,21 @@
+//go:build structr_48bit_hash
+// +build structr_48bit_hash
+
+package structr
+
+// Hash is the current compiler
+// flag defined cache key hash
+// checksum type. Here; uint48.
+type Hash [6]byte
+
+// uint64ToHash converts uint64 to currently Hash type.
+func uint64ToHash(u uint64) Hash {
+ return Hash{
+ 0: byte(u),
+ 1: byte(u >> 8),
+ 2: byte(u >> 16),
+ 3: byte(u >> 24),
+ 4: byte(u >> 32),
+ 5: byte(u >> 40),
+ }
+}