Skip to content

Commit

Permalink
Refactor m0_op_deref, no functional changes
Browse files Browse the repository at this point in the history
  • Loading branch information
leto committed Jul 7, 2013
1 parent 96a855f commit d3c5469
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions src/m0/c/ops.c
Expand Up @@ -33,23 +33,25 @@ whatever's at C<*$2[ *$3 ]>.
static void
m0_op_deref( M0_CallFrame *frame, const unsigned char *ops )
{
unsigned char reg = ops[1];
unsigned char ref = ops[2];
unsigned char key = ops[3];
uint64_t *registers = frame->registers;
unsigned char reg = ops[1];
unsigned char ref = ops[2];
unsigned char key = ops[3];

switch (ref) {
case CONSTS:
{
M0_Constants_Segment *consts = (M0_Constants_Segment *)frame->registers[ ref ];
unsigned long offset = frame->registers[ key ];
frame->registers[ reg ] = (uint64_t)consts->consts[offset];
M0_Constants_Segment *consts = (M0_Constants_Segment *)registers[ ref ];
unsigned long offset = registers[ key ];
registers[ reg ] = (uint64_t)consts->consts[offset];
break;
}
default:
{
unsigned long offset = frame->registers[ key ];
uint64_t * src = (uint64_t*)(frame->registers[ ref ]);
frame->registers[ reg ] = src[offset];
unsigned long offset = registers[ key ];
uint64_t * src = (uint64_t*)(registers[ ref ]);
registers[ reg ] = src[offset];

/* XXX: the rest of the system has non-uniform array handling */
break;
}
Expand Down

0 comments on commit d3c5469

Please sign in to comment.