Perform bitwise ops on unsigned types
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fri, 22 Sep 2017 21:03:34 +0000 (17:03 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Wed, 6 Jun 2018 20:42:04 +0000 (16:42 -0400)
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
lttng-filter-interpreter.c

index b1e5ba7360261a651386ebfa4485093a4a566237..4e6c91a7511715f2292fda00270a3f2e9d85effe 100644 (file)
@@ -995,7 +995,7 @@ uint64_t lttng_filter_interpret_bytecode(void *filter_data,
                                ret = -EINVAL;
                                goto end;
                        }
-                       res = (estack_bx_v >> estack_ax_v);
+                       res = ((uint64_t) estack_bx_v >> (uint32_t) estack_ax_v);
                        estack_pop(stack, top, ax, bx);
                        estack_ax_v = res;
                        next_pc += sizeof(struct binary_op);
@@ -1010,7 +1010,7 @@ uint64_t lttng_filter_interpret_bytecode(void *filter_data,
                                ret = -EINVAL;
                                goto end;
                        }
-                       res = (estack_bx_v << estack_ax_v);
+                       res = ((uint64_t) estack_bx_v << (uint32_t) estack_ax_v);
                        estack_pop(stack, top, ax, bx);
                        estack_ax_v = res;
                        next_pc += sizeof(struct binary_op);
@@ -1020,7 +1020,7 @@ uint64_t lttng_filter_interpret_bytecode(void *filter_data,
                {
                        int64_t res;
 
-                       res = (estack_bx_v & estack_ax_v);
+                       res = ((uint64_t) estack_bx_v & (uint64_t) estack_ax_v);
                        estack_pop(stack, top, ax, bx);
                        estack_ax_v = res;
                        next_pc += sizeof(struct binary_op);
@@ -1030,7 +1030,7 @@ uint64_t lttng_filter_interpret_bytecode(void *filter_data,
                {
                        int64_t res;
 
-                       res = (estack_bx_v | estack_ax_v);
+                       res = ((uint64_t) estack_bx_v | (uint64_t) estack_ax_v);
                        estack_pop(stack, top, ax, bx);
                        estack_ax_v = res;
                        next_pc += sizeof(struct binary_op);
@@ -1040,7 +1040,7 @@ uint64_t lttng_filter_interpret_bytecode(void *filter_data,
                {
                        int64_t res;
 
-                       res = (estack_bx_v ^ estack_ax_v);
+                       res = ((uint64_t) estack_bx_v ^ (uint64_t) estack_ax_v);
                        estack_pop(stack, top, ax, bx);
                        estack_ax_v = res;
                        next_pc += sizeof(struct binary_op);
@@ -1059,7 +1059,7 @@ uint64_t lttng_filter_interpret_bytecode(void *filter_data,
 
                OP(FILTER_OP_UNARY_BIT_NOT):
                {
-                       estack_ax_v = ~estack_ax_v;
+                       estack_ax_v = ~(uint64_t) estack_ax_v;
                        next_pc += sizeof(struct unary_op);
                        PO;
                }
This page took 0.034521 seconds and 4 git commands to generate.