Skip to content

Commit

Permalink
Fix swap_bits.cc solution
Browse files Browse the repository at this point in the history
  • Loading branch information
metopa committed Dec 5, 2019
1 parent 6867c6f commit cc12c05
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion epi_judge_cpp_solutions/swap_bits.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ long long SwapBits(long long x, int i, int j) {
// i-th and j-th bits differ. We will swap them by flipping their values.
// Select the bits to flip with bit_mask. Since x^1 = 0 when x = 1 and 1
// when x = 0, we can perform the flip XOR.
unsigned long long bit_mask = (1L << i) | (1L << j);
unsigned long long bit_mask = (1ULL << i) | (1ULL << j);
x ^= bit_mask;
}
return x;
Expand Down

0 comments on commit cc12c05

Please sign in to comment.