From: Erik Charlebois Date: Sun, 12 May 2013 02:30:22 +0000 (-0400) Subject: VM: Refactor tuples.cpp/hpp to Factor style X-Git-Tag: 0.97~1260 X-Git-Url: https://gitweb.factorcode.org/gitweb.cgi?p=factor.git;a=commitdiff_plain;h=5b1a9d753e565e97127b495957ae2ae9b3fc0c00 VM: Refactor tuples.cpp/hpp to Factor style --- diff --git a/vm/tuples.cpp b/vm/tuples.cpp index 0721b7fcee..a8a037f8fa 100644 --- a/vm/tuples.cpp +++ b/vm/tuples.cpp @@ -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 layout(ctx->pop(),this); - tagged t(allot(tuple_size(layout.untagged()))); - t->layout = layout.value(); +void factor_vm::primitive_tuple() { + data_root layout(ctx->pop(), this); + tagged t(allot(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 layout(ctx->pop(),this); - tagged t(allot(tuple_size(layout.untagged()))); - t->layout = layout.value(); +void factor_vm::primitive_tuple_boa() { + data_root layout(ctx->pop(), this); + tagged t(allot(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()); } } diff --git a/vm/tuples.hpp b/vm/tuples.hpp index bcd041fc65..75f91fced7 100644 --- a/vm/tuples.hpp +++ b/vm/tuples.hpp @@ -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); } }