about summary refs log tree commit diff stats
path: root/cpp/037call_reply.cc
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2015-05-04 11:02:56 -0700
committerKartik K. Agaram <vc@akkartik.com>2015-05-04 11:02:56 -0700
commita66c9ae68122e04637d65c7f3aedcd96012c8cb6 (patch)
treeceddf9f22c55621be86768a0aeedc927495e62d6 /cpp/037call_reply.cc
parentde49fb426aa44984d308f5856ec836360ba0bdce (diff)
downloadmu-a66c9ae68122e04637d65c7f3aedcd96012c8cb6.tar.gz
1249 - new type: index_t
It will always be identical to size_t, just more readable, like
recipe_number, etc. The various unsigned types are sizes, indices (which
often compare with sizes for bounds checking), numbers which are
canonical elements of a specific space (like recipes or mu types), and
ids which I haven't introduced yet.
Diffstat (limited to 'cpp/037call_reply.cc')
-rw-r--r--cpp/037call_reply.cc6
1 files changed, 3 insertions, 3 deletions
diff --git a/cpp/037call_reply.cc b/cpp/037call_reply.cc
index a0dfa2ea..39fb1606 100644
--- a/cpp/037call_reply.cc
+++ b/cpp/037call_reply.cc
@@ -22,7 +22,7 @@ Recipe_number["reply"] = REPLY;
 :(before "End Primitive Recipe Implementations")
 case REPLY: {
   vector<vector<int> > callee_results;
-  for (size_t i = 0; i < current_instruction().ingredients.size(); ++i) {
+  for (index_t i = 0; i < current_instruction().ingredients.size(); ++i) {
     callee_results.push_back(read_memory(current_instruction().ingredients[i]));
   }
   const instruction& reply_inst = current_instruction();  // save pointer into recipe before pop
@@ -30,7 +30,7 @@ case REPLY: {
   assert(!Current_routine->calls.empty());
   const instruction& caller_instruction = current_instruction();
   assert(caller_instruction.products.size() <= callee_results.size());
-  for (size_t i = 0; i < caller_instruction.products.size(); ++i) {
+  for (index_t i = 0; i < caller_instruction.products.size(); ++i) {
     trace("run") << "result " << i << " is " << to_string(callee_results[i]);
     // check that any reply ingredients with /same-as-ingredient connect up
     // the corresponding ingredient and product in the caller.
@@ -86,7 +86,7 @@ string to_string(const vector<int>& in) {
     return out.str();
   }
   out << "[";
-  for (size_t i = 0; i < in.size(); ++i) {
+  for (index_t i = 0; i < in.size(); ++i) {
     if (i > 0) out << ", ";
     out << in[i];
   }