From 9fbc090a01f0a88dfc36ca03f0fd791de1a2c2ea Mon Sep 17 00:00:00 2001 From: Konstantin Chukharev Date: Wed, 19 Jun 2024 01:02:31 +0300 Subject: [PATCH] Cleanup --- src/main/kotlin/com/github/lipen/bdd/BDD.kt | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/main/kotlin/com/github/lipen/bdd/BDD.kt b/src/main/kotlin/com/github/lipen/bdd/BDD.kt index aac7ba6..8513b47 100644 --- a/src/main/kotlin/com/github/lipen/bdd/BDD.kt +++ b/src/main/kotlin/com/github/lipen/bdd/BDD.kt @@ -20,14 +20,15 @@ class BDD( private val storage = Storage(1 shl storageBits) private val buckets = IntArray(1 shl bucketsBits) - val one = Ref(1) // terminal 1 - val zero = Ref(-1) // terminal 0 - init { - check(storage.alloc() == 1) // allocate the terminal node - buckets[0] = 1 // store the terminal node in the 0th bucket + val terminal = storage.alloc() // allocate the terminal node + check(terminal == 1) + buckets[0] = terminal // store the terminal node in the 0th bucket } + val one = Ref(1) // terminal 1 + val zero = Ref(-1) // terminal 0 + val size: Int get() = storage.lastIndex val realSize: Int get() = storage.realSize