aboutsummaryrefslogtreecommitdiff
path: root/genlap.go
diff options
context:
space:
mode:
Diffstat (limited to 'genlap.go')
-rw-r--r--genlap.go18
1 files changed, 18 insertions, 0 deletions
diff --git a/genlap.go b/genlap.go
new file mode 100644
index 0000000..504db74
--- /dev/null
+++ b/genlap.go
@@ -0,0 +1,18 @@
+//go:build !appengine
+
+package rabaead
+
+import "unsafe"
+
+func anyOverlap(x, y []byte) bool {
+ return len(x) > 0 && len(y) > 0 &&
+ uintptr(unsafe.Pointer(&x[0])) <= uintptr(unsafe.Pointer(&y[len(y)-1])) &&
+ uintptr(unsafe.Pointer(&y[0])) <= uintptr(unsafe.Pointer(&x[len(x)-1]))
+}
+
+func inexactOverlap(x, y []byte) bool {
+ if len(x) == 0 || len(y) == 0 || &x[0] == &y[0] {
+ return false
+ }
+ return anyOverlap(x, y)
+}

Snix LLC Git Repository Holder Copyright(C) 2022 All Rights Reserved Email To Snix.IR