summaryrefslogtreecommitdiff
path: root/vendor/github.com/dalzilio/rudd/kernel.go
diff options
context:
space:
mode:
authormo khan <mo@mokhan.ca>2025-07-22 17:35:49 -0600
committermo khan <mo@mokhan.ca>2025-07-22 17:35:49 -0600
commit20ef0d92694465ac86b550df139e8366a0a2b4fa (patch)
tree3f14589e1ce6eb9306a3af31c3a1f9e1af5ed637 /vendor/github.com/dalzilio/rudd/kernel.go
parent44e0d272c040cdc53a98b9f1dc58ae7da67752e6 (diff)
feat: connect to spicedb
Diffstat (limited to 'vendor/github.com/dalzilio/rudd/kernel.go')
-rw-r--r--vendor/github.com/dalzilio/rudd/kernel.go36
1 files changed, 36 insertions, 0 deletions
diff --git a/vendor/github.com/dalzilio/rudd/kernel.go b/vendor/github.com/dalzilio/rudd/kernel.go
new file mode 100644
index 0000000..214df37
--- /dev/null
+++ b/vendor/github.com/dalzilio/rudd/kernel.go
@@ -0,0 +1,36 @@
+// Copyright (c) 2021 Silvano DAL ZILIO
+//
+// MIT License
+
+package rudd
+
+import (
+ "errors"
+)
+
+// number of bytes in a int (adapted from uintSize in the math/bits package)
+const huddsize = (2*(32<<(^uint(0)>>32&1)) + 32) / 8 // 12 (32 bits) or 20 (64 bits)
+
+// _MINFREENODES is the minimal number of nodes (%) that has to be left after a
+// garbage collect unless a resize should be done.
+const _MINFREENODES int = 20
+
+// _MAXVAR is the maximal number of levels in the BDD. We use only the first 21
+// bits for encoding levels (so also the max number of variables). We use 11
+// other bits for markings. Hence we make sure to always use int32 to avoid
+// problem when we change architecture.
+const _MAXVAR int32 = 0x1FFFFF
+
+// _MAXREFCOUNT is the maximal value of the reference counter (refcou), also
+// used to stick nodes (like constants and variables) in the node list. It is
+// egal to 1023 (10 bits).
+const _MAXREFCOUNT int32 = 0x3FF
+
+// _DEFAULTMAXNODEINC is the default value for the maximal increase in the
+// number of nodes during a resize. It is approx. one million nodes (1 048 576)
+// (could be interesting to change it to 1 << 23 = 8 388 608).
+const _DEFAULTMAXNODEINC int = 1 << 20
+
+var errMemory = errors.New("unable to free memory or resize BDD")
+var errResize = errors.New("should cache resize") // when gbc and then noderesize
+var errReset = errors.New("should cache reset") // when gbc only, without resizing