about summary refs log tree commit diff stats
path: root/cpp/012run
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2015-03-16 22:52:04 -0700
committerKartik K. Agaram <vc@akkartik.com>2015-03-16 22:52:04 -0700
commita4ef18b194a24710847be59554e51a1fd618228d (patch)
tree2c717ae73346922b4ecdc2ac108ed0cb73da1d79 /cpp/012run
parent100157d1a83ccb02d82af21c5767ecda3d7cb1c2 (diff)
downloadmu-a4ef18b194a24710847be59554e51a1fd618228d.tar.gz
940 - c++: some changes to instruction model
Diffstat (limited to 'cpp/012run')
-rw-r--r--cpp/012run11
1 files changed, 2 insertions, 9 deletions
diff --git a/cpp/012run b/cpp/012run
index bb084b39..8ae164c3 100644
--- a/cpp/012run
+++ b/cpp/012run
@@ -112,10 +112,10 @@ vector<int> read_memory(reagent x) {
 //?   cout << "read_memory: " << x.to_string() << '\n'; //? 1
   vector<int> result;
   if (x.types[0] == 0) {  // literal
-    result.push_back(to_int(x.name));
+    result.push_back(x.value);
     return result;
   }
-  int base = to_int(x.name);
+  int base = x.value;
   for (size_t offset = 0; offset < Type[x.types[0]].size; ++offset) {
     int val = Memory[base+offset];
     trace("mem") << "location " << base+offset << " is " << val;
@@ -135,13 +135,6 @@ void write_memory(reagent x, vector<int> data) {
 }
 
 :(code)
-int to_int(string n) {
-  char* end = NULL;
-  int result = strtol(n.c_str(), &end, /*any base*/0);
-  assert(*end == '\0');
-  return result;
-}
-
 size_t size_of(reagent r) {
   type_info t = Type[r.types[0]];
   if (!t.is_record && !t.is_array) return t.size;