Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
BurningWitness committed Sep 2, 2024
1 parent d7e2a2b commit 5ae596c
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Fixed `Data.Zebra.Word.fillRange`.
Previously it produced malformed trees in certain cases.

## 1.0.0.1 -- April 2024
## 1.0.0.1 -- May 2024

* Radix tree performance tweaks

Expand Down
2 changes: 1 addition & 1 deletion src/Data/Zebra/Word/Debug.hs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import Numeric.Long
import Radix.Word.Foundation
import Radix.Word.Debug

import Debug.Trace


-- | \(\mathcal{O}(n)\).
-- Shows the internal structure of the tree.
Expand Down
6 changes: 3 additions & 3 deletions src/Radix/Word/Debug.hs
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ data S = L -- ^ Left. Masked bit of the prefix above this node must be @0@.
validPrefix :: Prefix -> S -> Prefix -> Bool
validPrefix p s o =
let low = p .&. negate p
in even p && case s of
L -> o < p && p - o < low
R -> p < o && o - p < low
in case s of
L -> o < p && p - o < low
R -> p < o && o - p < low

-- | Check whether the key below aligns with the side the branch is on.
validKey :: Prefix -> S -> Key -> Bool
Expand Down
6 changes: 3 additions & 3 deletions src/Radix/Word8/Debug.hs
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ data S = L -- ^ Left. Masked bit of the prefix above this node must be @0@.
validPrefix :: Prefix -> S -> Prefix -> Bool
validPrefix p s o =
let low = p .&. negate p
in even p && case s of
L -> o < p && p - o < low
R -> p < o && o - p < low
in case s of
L -> o < p && p - o < low
R -> p < o && o - p < low



Expand Down

0 comments on commit 5ae596c

Please sign in to comment.