IIRC you cannot assume what number primitives correspond to what bits nor that shifting corresponds to dividing and multiplying by 2. Big/little endian aside, the spec doesn't enforce it (in every language). That's one of the reasons we have boolean operators in the first place.
While this may not be the case in every language, at least JavaScript got you covered:
Shift operators convert their operands to 32-bit integers in big-endian order and return a result of the same type as the left operand. The right operand should be less than 32, but if not only the low five bits will be used (see developer.mozilla.org/en-US/docs/W...).
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
IIRC you cannot assume what number primitives correspond to what bits nor that shifting corresponds to dividing and multiplying by 2. Big/little endian aside, the spec doesn't enforce it (in every language). That's one of the reasons we have boolean operators in the first place.
While this may not be the case in every language, at least JavaScript got you covered:
Shift operators convert their operands to 32-bit integers in big-endian order and return a result of the same type as the left operand. The right operand should be less than 32, but if not only the low five bits will be used (see developer.mozilla.org/en-US/docs/W...).