From 2f02189ddcdeb7d25b0ca9bd5b955b764d41a1a7 Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Sat, 21 May 2016 17:44:53 -0700 Subject: 2996 --- html/078hash.cc.html | 26 +++++++------------------- 1 file changed, 7 insertions(+), 19 deletions(-) (limited to 'html/078hash.cc.html') diff --git a/html/078hash.cc.html b/html/078hash.cc.html index 0f3153f7..aa8c8724 100644 --- a/html/078hash.cc.html +++ b/html/078hash.cc.html @@ -57,7 +57,7 @@ put(Recipe_ordinal,} :(before "End Primitive Recipe Implementations") case HASH: { - reagent input = current_instruction().ingredients.at(0); // copy + reagent/*copy*/ input = current_instruction().ingredients.at(0); products.resize(1); products.at(0).push_back(hash(0, input)); break; @@ -111,11 +111,11 @@ put(Recipe_ordinal,size_t hash_mu_array(size_t h, const reagent& r) { int size = get_or_insert(Memory, r.value); - reagent elem = r; + reagent/*copy*/ elem = r; delete elem.type; - elem.type = new type_tree(*array_element(r.type)); + elem.type = copy_array_element(r.type); for (int i=0, address = r.value+1; i < size; ++i, address += size_of(elem)) { - reagent tmp = elem; + reagent/*copy*/ tmp = elem; tmp.value = address; h = hash(h, tmp); //? cerr << i << " (" << address << "): " << h << '\n'; @@ -123,19 +123,13 @@ put(Recipe_ordinal,return h; } -bool is_mu_container(const reagent& r) { - if (r.type->value == 0) return false; - type_info& info = get(Type, r.type->value); - return info.kind == CONTAINER; -} - size_t hash_mu_container(size_t h, const reagent& r) { assert(r.type->value); type_info& info = get(Type, r.type->value); int address = r.value; int offset = 0; for (int i = 0; i < SIZE(info.elements); ++i) { - reagent element = element_type(r, i); + reagent/*copy*/ element = element_type(r.type, i); if (has_property(element, "ignore-for-hash")) continue; element.set_value(address+offset); h = hash(h, element); @@ -145,16 +139,10 @@ put(Recipe_ordinal,return h; } -bool is_mu_exclusive_container(const reagent& r) { - if (r.type->value == 0) return false; - type_info& info = get(Type, r.type->value); - return info.kind == EXCLUSIVE_CONTAINER; -} - size_t hash_mu_exclusive_container(size_t h, const reagent& r) { assert(r.type->value); int tag = get(Memory, r.value); - reagent variant = variant_type(r, tag); + reagent/*copy*/ variant = variant_type(r, tag); // todo: move this error to container definition time if (has_property(variant, "ignore-for-hash")) raise << get(Type, r.type->value).name << ": /ignore-for-hash won't work in exclusive containers\n" << end(); @@ -402,7 +390,7 @@ put(Recipe_ordinal,break; } if (!is_mu_string(inst.ingredients.at(0))) { - raise << maybe(get(Recipe, r).name) << "'hash_old' currently only supports strings (address:array:character), but got " << inst.ingredients.at(0).original_string << '\n' << end(); + raise << maybe(get(Recipe, r).name) << "'hash_old' currently only supports strings (address:array:character), but got '" << inst.ingredients.at(0).original_string << "'\n" << end(); break; } break; -- cgit 1.4.1-2-gfad0