Skip to content

Commit

Permalink
fix gpr_stack_lockfree_test assert bug on 64 bits
Browse files Browse the repository at this point in the history
  • Loading branch information
ksophocleous committed Dec 16, 2015
1 parent 80428e6 commit 147cc70
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/core/support/stack_lockfree.c
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,8 @@ int gpr_stack_lockfree_push(gpr_stack_lockfree *stack, int entry) {
gpr_atm old_val;

old_val = gpr_atm_no_barrier_fetch_add(&stack->pushed[pushed_index],
(gpr_atm)(1UL << pushed_bit));
GPR_ASSERT((old_val & (gpr_atm)(1UL << pushed_bit)) == 0);
((gpr_atm)1 << pushed_bit));
GPR_ASSERT((old_val & ((gpr_atm)1 << pushed_bit)) == 0);
}
#endif

Expand Down Expand Up @@ -166,8 +166,8 @@ int gpr_stack_lockfree_pop(gpr_stack_lockfree *stack) {
gpr_atm old_val;

old_val = gpr_atm_no_barrier_fetch_add(&stack->pushed[pushed_index],
-(gpr_atm)(1UL << pushed_bit));
GPR_ASSERT((old_val & (gpr_atm)(1UL << pushed_bit)) != 0);
-((gpr_atm)1 << pushed_bit));
GPR_ASSERT((old_val & ((gpr_atm)1 << pushed_bit)) != 0);
}
#endif

Expand Down

0 comments on commit 147cc70

Please sign in to comment.