Permalink
Browse files

rewrite bitwise operation function

  • Loading branch information...
1 parent 88233c7 commit ae595d911fd7350ee59346f12ab2d071025a8ad7 Jimmy Zhuo committed Apr 4, 2012
Showing with 12 additions and 12 deletions.
  1. +1 −1 src/m0/c/include/m0_interp_structures.h
  2. +11 −11 src/m0/c/m0_ops.c
@@ -20,7 +20,7 @@ typedef union {
typedef union {
double n[128];
- long i[128];
+ int64_t i[128];
} Regs_ni;
typedef struct {
View
@@ -169,7 +169,7 @@ m0_op_convert_n_i( M0_CallFrame *frame, const unsigned char *ops )
static void
m0_op_convert_i_n( M0_CallFrame *frame, const unsigned char *ops )
{
- frame->regs_ni.i[ops[1]] = (int)frame->regs_ni.n[ops[2]];
+ frame->regs_ni.i[ops[1]] = (int64_t)frame->regs_ni.n[ops[2]];
}
static void
@@ -230,36 +230,36 @@ m0_op_mod_n( M0_CallFrame *frame, const unsigned char *ops )
static void
m0_op_and( M0_CallFrame *frame, const unsigned char *ops )
{
- frame->registers[ops[1]] = frame->registers[ops[2]] &
- frame->registers[ops[3]];
+ frame->regs_ni.i[ops[1]] = frame->regs_ni.i[ops[2]] &
+ frame->regs_ni.i[ops[3]];
}
static void
m0_op_or( M0_CallFrame *frame, const unsigned char *ops )
{
- frame->registers[ops[1]] = frame->registers[ops[2]] |
- frame->registers[ops[3]];
+ frame->regs_ni.i[ops[1]] = frame->regs_ni.i[ops[2]] |
+ frame->regs_ni.i[ops[3]];
}
static void
m0_op_xor( M0_CallFrame *frame, const unsigned char *ops )
{
- frame->registers[ops[1]] = frame->registers[ops[2]] ^
- frame->registers[ops[3]];
+ frame->regs_ni.i[ops[1]] = frame->regs_ni.i[ops[2]] ^
+ frame->regs_ni.i[ops[3]];
}
static void
m0_op_lshr( M0_CallFrame *frame, const unsigned char *ops )
{
- frame->registers[ops[1]] = frame->registers[ops[2]] >>
- frame->registers[ops[3]];
+ frame->regs_ni.i[ops[1]] = (uint64_t)frame->regs_ni.i[ops[2]] >>
+ frame->regs_ni.i[ops[3]];
}
static void
m0_op_ashr( M0_CallFrame *frame, const unsigned char *ops )
{
- frame->registers[ops[1]] = (int)frame->registers[ops[2]] >>
- frame->registers[ops[3]];
+ frame->regs_ni.i[ops[1]] = (int64_t)frame->regs_ni.i[ops[2]] >>
+ frame->regs_ni.i[ops[3]];
}
static void

0 comments on commit ae595d9

Please sign in to comment.