lemire / FastBitSet.js

Speed-optimized BitSet implementation for modern browsers and JavaScript engines
Apache License 2.0
158 stars 19 forks source link

Why the `0 | 0`? #23

Closed modulovalue closed 8 months ago

modulovalue commented 8 months ago

Hello @lemire,

Just a very quick question. I've noticed that you're using 0 | 0 in various places:

e.g.:

https://github.com/lemire/FastBitSet.js/blob/d673f8ed91b4eb4e0104881aa1ff0402c3203648/FastBitSet.js#L383

or

https://github.com/lemire/FastBitSet.js/blob/d673f8ed91b4eb4e0104881aa1ff0402c3203648/FastBitSet.js#L168-L172

It looks to me like the result of that expression is 0, so it could be replaced with just a 0 literal? Am I failing to recognize some trick here?

lemire commented 8 months ago

0 is a number, possibly a floating-point number; 0|0 is an integer, never a floating-point number.