mirror of
https://github.moeyy.xyz/https://github.com/trekhleb/javascript-algorithms.git
synced 2024-09-20 07:43:04 +08:00
Shifted method has been changed
This commit is contained in:
parent
ca3d16dcce
commit
813b7a85df
@ -10,8 +10,8 @@ export default function countSetBits(originalNumber) {
|
||||
// Add last bit of the number to the sum of set bits.
|
||||
setBitsCount += number & 1;
|
||||
|
||||
// Shift number right by one bit to investigate other bits.
|
||||
number >>>= 1;
|
||||
// Arithmetic Shift number right by one bit to investigate other bits.
|
||||
number >>= 1;
|
||||
}
|
||||
|
||||
return setBitsCount;
|
||||
|
Loading…
Reference in New Issue
Block a user