From e4ac3c9e6e5464a0fc0f8fd3763a572e0e180c04 Mon Sep 17 00:00:00 2001 From: Kartik Agaram Date: Sat, 1 Dec 2018 14:13:33 -0800 Subject: 4814 --- html/069hash.cc.html | 56 +++++++++++++++++++++++++++------------------------- 1 file changed, 29 insertions(+), 27 deletions(-) (limited to 'html/069hash.cc.html') diff --git a/html/069hash.cc.html b/html/069hash.cc.html index 1d90a537..e58c2b13 100644 --- a/html/069hash.cc.html +++ b/html/069hash.cc.html @@ -11,23 +11,24 @@ @@ -61,6 +62,7 @@ if ('onhashchange' in window) { +https://github.com/akkartik/mu/blob/master/069hash.cc
   1 // Compute a hash for objects of any type.
   2 //
@@ -75,11 +77,11 @@ if ('onhashchange' in window) {
  11 :(before "End Primitive Recipe Declarations")
  12 HASH,
  13 :(before "End Primitive Recipe Numbers")
- 14 put(Recipe_ordinal, "hash", HASH);
+ 14 put(Recipe_ordinal, "hash", HASH);
  15 :(before "End Primitive Recipe Checks")
  16 case HASH: {
  17   if (SIZE(inst.ingredients) != 1) {
- 18     raise << maybe(get(Recipe, r).name) << "'hash' takes exactly one ingredient rather than '" << to_original_string(inst) << "'\n" << end();
+ 18     raise << maybe(get(Recipe, r).name) << "'hash' takes exactly one ingredient rather than '" << to_original_string(inst) << "'\n" << end();
  19     break;
  20   }
  21   break;
@@ -113,20 +115,20 @@ if ('onhashchange' in window) {
  49 }
  50 
  51 size_t hash_mu_scalar(size_t h, const reagent& r) {
- 52   double input = is_literal(r) ? r.value : get_or_insert(Memory, r.value);
+ 52   double input = is_literal(r) ? r.value : get_or_insert(Memory, r.value);
  53   return hash_iter(h, static_cast<size_t>(input));
  54 }
  55 
  56 size_t hash_mu_address(size_t h, reagent& r) {
  57   if (r.value == 0) return 0;
- 58   trace("mem") << "location " << r.value << " is " << no_scientific(get_or_insert(Memory, r.value)) << end();
- 59   r.set_value(get_or_insert(Memory, r.value));
+ 58   trace("mem") << "location " << r.value << " is " << no_scientific(get_or_insert(Memory, r.value)) << end();
+ 59   r.set_value(get_or_insert(Memory, r.value));
  60   drop_from_type(r, "address");
  61   return hash(h, r);
  62 }
  63 
  64 size_t hash_mu_text(size_t h, const reagent& r) {
- 65   string input = read_mu_text(get_or_insert(Memory, r.value+/*skip alloc id*/1));
+ 65   string input = read_mu_text(get_or_insert(Memory, r.value+/*skip alloc id*/1));
  66   for (int i = 0;  i < SIZE(input);  ++i) {
  67     h = hash_iter(h, static_cast<size_t>(input.at(i)));
  68 //?     cerr << i << ": " << h << '\n';
@@ -135,7 +137,7 @@ if ('onhashchange' in window) {
  71 }
  72 
  73 size_t hash_mu_array(size_t h, const reagent& r) {
- 74   int size = get_or_insert(Memory, r.value);
+ 74   int size = get_or_insert(Memory, r.value);
  75   reagent/*copy*/ elem = r;
  76   delete elem.type;
  77   elem.type = copy_array_element(r.type);
@@ -149,7 +151,7 @@ if ('onhashchange' in window) {
  85 }
  86 
  87 size_t hash_mu_container(size_t h, const reagent& r) {
- 88   type_info& info = get(Type, get_base_type(r.type)->value);
+ 88   type_info& info = get(Type, get_base_type(r.type)->value);
  89   int address = r.value;
  90   int offset = 0;
  91   for (int i = 0;  i < SIZE(info.elements);  ++i) {
@@ -166,11 +168,11 @@ if ('onhashchange' in window) {
 102 size_t hash_mu_exclusive_container(size_t h, const reagent& r) {
 103   const type_tree* type = get_base_type(r.type);
 104   assert(type->value);
-105   int tag = get(Memory, r.value);
+105   int tag = get(Memory, r.value);
 106   reagent/*copy*/ variant = variant_type(r, tag);
 107   // todo: move this error to container definition time
 108   if (has_property(variant, "ignore-for-hash"))
-109     raise << get(Type, type->value).name << ": /ignore-for-hash won't work in exclusive containers\n" << end();
+109     raise << get(Type, type->value).name << ": /ignore-for-hash won't work in exclusive containers\n" << end();
 110   variant.set_value(r.value + /*skip tag*/1);
 111   h = hash(h, variant);
 112   return h;
@@ -392,15 +394,15 @@ if ('onhashchange' in window) {
 328 :(before "End Primitive Recipe Declarations")
 329 HASH_OLD,
 330 :(before "End Primitive Recipe Numbers")
-331 put(Recipe_ordinal, "hash_old", HASH_OLD);
+331 put(Recipe_ordinal, "hash_old", HASH_OLD);
 332 :(before "End Primitive Recipe Checks")
 333 case HASH_OLD: {
 334   if (SIZE(inst.ingredients) != 1) {
-335     raise << maybe(get(Recipe, r).name) << "'hash_old' takes exactly one ingredient rather than '" << to_original_string(inst) << "'\n" << end();
+335     raise << maybe(get(Recipe, r).name) << "'hash_old' takes exactly one ingredient rather than '" << to_original_string(inst) << "'\n" << end();
 336     break;
 337   }
 338   if (!is_mu_text(inst.ingredients.at(0))) {
-339     raise << maybe(get(Recipe, r).name) << "'hash_old' currently only supports texts (address array character), but got '" << inst.ingredients.at(0).original_string << "'\n" << end();
+339     raise << maybe(get(Recipe, r).name) << "'hash_old' currently only supports texts (address array character), but got '" << inst.ingredients.at(0).original_string << "'\n" << end();
 340     break;
 341   }
 342   break;
-- 
cgit 1.4.1-2-gfad0