about summary refs log tree commit diff stats
path: root/034exclusive_container.cc
diff options
context:
space:
mode:
Diffstat (limited to '034exclusive_container.cc')
-rw-r--r--034exclusive_container.cc7
1 files changed, 4 insertions, 3 deletions
diff --git a/034exclusive_container.cc b/034exclusive_container.cc
index b2855f79..5b849916 100644
--- a/034exclusive_container.cc
+++ b/034exclusive_container.cc
@@ -89,19 +89,20 @@ Recipe_number["maybe-convert"] = MAYBE_CONVERT;
 :(before "End Primitive Recipe Implementations")
 case MAYBE_CONVERT: {
   reagent base = canonize(current_instruction().ingredients.at(0));
-  index_t base_address = base.value;
+  assert(!is_negative(base.value));
+  index_t base_address = value(base.value);
   type_number base_type = base.types.at(0);
   assert(Type[base_type].kind == exclusive_container);
   assert(isa_literal(current_instruction().ingredients.at(1)));
   index_t tag = current_instruction().ingredients.at(1).value;
   long long int result;
-  if (tag == static_cast<index_t>(Memory[base_address])) {
+  if (tag == static_cast<index_t>(value(Memory[base_address]))) {
     result = base_address+1;
   }
   else {
     result = 0;
   }
   products.resize(1);
-  products.at(0).push_back(result);
+  products.at(0).push_back(mu_integer(result));  // address must be a positive integer
   break;
 }