From 9f1bb45d9b1a43daa229714d4eb83e981a187f92 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Tue, 16 Jun 2015 13:24:05 -0700 Subject: entities: Make the first entity in the array (TripleDot) work. We now use -1 instead of 0 to indicate leaf nodes. --- tools/make_entities_h.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'tools') 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*)\"" + -- cgit v1.2.3