about summary refs log tree commit diff stats
path: root/cpp/019address
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2015-03-26 17:03:07 -0700
committerKartik K. Agaram <vc@akkartik.com>2015-03-26 17:03:07 -0700
commitc82d01762778baeb71c26365479e3c1cddcfbf13 (patch)
tree846100fbc599414b520d5049ffa14182318a5451 /cpp/019address
parentc63e2811a14344801950d075ca89c3601e73f065 (diff)
downloadmu-c82d01762778baeb71c26365479e3c1cddcfbf13.tar.gz
973
Diffstat (limited to 'cpp/019address')
-rw-r--r--cpp/019address8
1 files changed, 3 insertions, 5 deletions
diff --git a/cpp/019address b/cpp/019address
index 28fa4515..a642ceb1 100644
--- a/cpp/019address
+++ b/cpp/019address
@@ -15,7 +15,7 @@ recipe main [
 :(replace{} "vector<int> read_memory(reagent x)")
 vector<int> read_memory(reagent x) {
   vector<int> result;
-  if (x.types[0] == 0) {  // literal
+  if (isa_literal(x)) {
     result.push_back(x.value);
     return result;
   }
@@ -133,8 +133,7 @@ case GET: {
   int base_type = base.types[0];
   assert(Type[base_type].is_record);
   trace("run") << "ingredient 1 is " << instructions[pc].ingredients[1].name;
-  assert(instructions[pc].ingredients[1].types.size() == 1);
-  assert(instructions[pc].ingredients[1].types[0] == 0);  // must be literal
+  assert(isa_literal(instructions[pc].ingredients[1]));
   size_t offset = instructions[pc].ingredients[1].value;
   int src = base_address;
   for (size_t i = 0; i < offset; ++i) {
@@ -176,8 +175,7 @@ case GET_ADDRESS: {
   int base_type = base.types[0];
   assert(Type[base_type].is_record);
   trace("run") << "ingredient 1 is " << instructions[pc].ingredients[1].name;
-  assert(instructions[pc].ingredients[1].types.size() == 1);
-  assert(instructions[pc].ingredients[1].types[0] == 0);  // must be literal
+  assert(isa_literal(instructions[pc].ingredients[1]));
   size_t offset = instructions[pc].ingredients[1].value;
   int src = base_address;
   for (size_t i = 0; i < offset; ++i) {