]> gitweb.factorcode.org Git - factor.git/commitdiff
VM: Refactor tuples.cpp/hpp to Factor style
authorErik Charlebois <erikcharlebois@gmail.com>
Sun, 12 May 2013 02:30:22 +0000 (22:30 -0400)
committerErik Charlebois <erikcharlebois@gmail.com>
Sun, 12 May 2013 17:24:48 +0000 (13:24 -0400)
vm/tuples.cpp
vm/tuples.hpp

index 0721b7fceeaa87627eac252dda7857c3ad4041e7..a8a037f8fa25a94df7567641498a989b1df40da3 100644 (file)
@@ -1,34 +1,32 @@
 #include "master.hpp"
 
-namespace factor
-{
+namespace factor {
 
 /* push a new tuple on the stack, filling its slots with f */
 /* Allocates memory */
-void factor_vm::primitive_tuple()
-{
-       data_root<tuple_layout> layout(ctx->pop(),this);
-       tagged<tuple> t(allot<tuple>(tuple_size(layout.untagged())));
-       t->layout = layout.value();
+void factor_vm::primitive_tuple() {
+  data_root<tuple_layout> layout(ctx->pop(), this);
+  tagged<tuple> t(allot<tuple>(tuple_size(layout.untagged())));
+  t->layout = layout.value();
 
-       memset_cell(t->data(),false_object,tuple_size(layout.untagged()) - sizeof(cell));
+  memset_cell(t->data(), false_object,
+              tuple_size(layout.untagged()) - sizeof(cell));
 
-       ctx->push(t.value());
+  ctx->push(t.value());
 }
 
 /* push a new tuple on the stack, filling its slots from the stack */
 /* Allocates memory */
-void factor_vm::primitive_tuple_boa()
-{
-       data_root<tuple_layout> layout(ctx->pop(),this);
-       tagged<tuple> t(allot<tuple>(tuple_size(layout.untagged())));
-       t->layout = layout.value();
+void factor_vm::primitive_tuple_boa() {
+  data_root<tuple_layout> layout(ctx->pop(), this);
+  tagged<tuple> t(allot<tuple>(tuple_size(layout.untagged())));
+  t->layout = layout.value();
 
-       cell size = untag_fixnum(layout.untagged()->size) * sizeof(cell);
-       memcpy(t->data(),(cell *)(ctx->datastack - size + sizeof(cell)),size);
-       ctx->datastack -= size;
+  cell size = untag_fixnum(layout.untagged()->size) * sizeof(cell);
+  memcpy(t->data(), (cell*)(ctx->datastack - size + sizeof(cell)), size);
+  ctx->datastack -= size;
 
-       ctx->push(t.value());
+  ctx->push(t.value());
 }
 
 }
index bcd041fc65d07b60b8d7cf6cbe13960b9200ad0c..75f91fced71839e68e02f8afe65f62688e98a8a0 100644 (file)
@@ -1,10 +1,8 @@
-namespace factor
-{
+namespace factor {
 
-inline static cell tuple_size(const tuple_layout *layout)
-{
-       cell size = untag_fixnum(layout->size);
-       return sizeof(tuple) + size * sizeof(cell);
+inline static cell tuple_size(const tuple_layout* layout) {
+  cell size = untag_fixnum(layout->size);
+  return sizeof(tuple) + size * sizeof(cell);
 }
 
 }