From f8d427406a03b85966a3f7a1e621a95d7275a988 Mon Sep 17 00:00:00 2001 From: Mathieu Desnoyers Date: Fri, 22 Sep 2017 17:03:34 -0400 Subject: [PATCH] Perform bitwise ops on unsigned types Signed-off-by: Mathieu Desnoyers --- lttng-filter-interpreter.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lttng-filter-interpreter.c b/lttng-filter-interpreter.c index b1e5ba73..4e6c91a7 100644 --- a/lttng-filter-interpreter.c +++ b/lttng-filter-interpreter.c @@ -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; } -- 2.34.1