summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2015-06-16 13:24:05 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2015-06-16 13:24:05 -0700
commit9f1bb45d9b1a43daa229714d4eb83e981a187f92 (patch)
tree357fb379c8273dc6ba6cefecb0b49eb9a4a8daea /tools
parent9ae4975fc049de433ad8e2399c391d207208233a (diff)
entities: Make the first entity in the array (TripleDot) work.
We now use -1 instead of 0 to indicate leaf nodes.
Diffstat (limited to 'tools')
-rw-r--r--tools/make_entities_h.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/tools/make_entities_h.py b/tools/make_entities_h.py
index 5c24825..90831a9 100644
--- a/tools/make_entities_h.py
+++ b/tools/make_entities_h.py
@@ -42,7 +42,7 @@ lines = [""] * len(hashed_data)
# in this list. Adds to lines a line for the midpoint, then calls
# itself recursively for the earlier and later elements. Each node
# contains indices for elements with a lesser hash and elements with
-# a greater hash. An index of 0 means we're at a leaf node.
+# a greater hash. An index of -1 means we're at a leaf node.
def to_binary_array(xs, mid):
# divide in half, and form binary array from each half
x = xs[mid]
@@ -51,11 +51,11 @@ def to_binary_array(xs, mid):
midlesses = len(lesses) // 2
midgreaters = len(greaters) // 2
if len(lesses) == 0:
- ml = 0
+ ml = -1
else:
ml = indices[lesses[midlesses][0]]
if len(greaters) == 0:
- mg = 0
+ mg = -1
else:
mg = indices[greaters[midgreaters][0]]
lines[indices[x[0]]] = ("{" + str(x[0]) + ", (unsigned char*)\"" +