Skip to content

Commit

Permalink
document algorithm
Browse files Browse the repository at this point in the history
  • Loading branch information
ericvergnaud committed Mar 10, 2024
1 parent 967be76 commit c3692cc
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions runtime/JavaScript/src/antlr4/misc/BitSet.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ export default class BitSet {
}

_bitCount(l) {
// see https://graphics.stanford.edu/~seander/bithacks.html#CountBitsSetParallel
let count = 0;
l = l - ((l >> 1) & 0x55555555);
l = (l & 0x33333333) + ((l >> 2) & 0x33333333);
Expand Down

0 comments on commit c3692cc

Please sign in to comment.