Skip to content

Commit

Permalink
Merge pull request grpc#4484 from alfatraining/fix_test/gpr_stack_loc…
Browse files Browse the repository at this point in the history
…kfree_test

fix gpr_stack_lockfree_test assert bug on 64 bits
  • Loading branch information
ctiller committed Dec 16, 2015
2 parents aff6d61 + 1ce471a commit 9e38c21
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 9e38c21

Please sign in to comment.