diff options
author | Kartik Agaram <vc@akkartik.com> | 2018-05-12 08:08:10 -0700 |
---|---|---|
committer | Kartik Agaram <vc@akkartik.com> | 2018-05-12 08:08:10 -0700 |
commit | bd222553d7bc7d91d3eebae5639b01f58c8f7c75 (patch) | |
tree | 3af8f319923ab35408feb7a257b88ec08d9a36c7 | |
parent | 66e6eaf4f26648649061f655ccb3cb7f97cbf537 (diff) | |
download | mu-bd222553d7bc7d91d3eebae5639b01f58c8f7c75.tar.gz |
4241
Comparing types by value rather than name seems a bit cleaner. It isn't noticeably faster, though. 4178 - refcount-based memory management 3:27 3:18 3:15 3:15 3:15 4179 - no more abandon 2:13 2:13 2:12 2:11 2:09 2:10 4239 1:42 1:41 1:51 1:43 1:43 1:41 4241 (this commit) 1:53 1:45 1:43 1:43 1:42 1:42
-rw-r--r-- | 010vm.cc | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/010vm.cc b/010vm.cc index f34f2232..993e051c 100644 --- a/010vm.cc +++ b/010vm.cc @@ -401,7 +401,7 @@ bool type_tree::operator==(const type_tree& other) const { // only constraint we care about: if a < b then !(b < a) bool type_tree::operator<(const type_tree& other) const { if (atom != other.atom) return atom > other.atom; // atoms before non-atoms - if (atom) return name < other.name; // sort atoms in lexical order + if (atom) return value < other.value; // first location in one that's missing in the other makes that side 'smaller' if (left && !other.left) return false; if (!left && other.left) return true; @@ -455,7 +455,7 @@ void test_compare_list_with_extra_element() { CHECK(!(*b.type < *a.type)); } void test_compare_list_with_smaller_left_but_larger_right() { - reagent a("a:address:number"), b("b:character:array"); + reagent a("a:number:character"), b("b:boolean:array"); CHECK(*a.type < *b.type); CHECK(!(*b.type < *a.type)); } |