I want to perform bitwise operations with some large values:
var someVariable = 4;
someVariable |= 36028797018963968; // add flag, 1 << 55
However, the result always ends up being 4
instead of 36028797018963972
. After some research, I came across this answer which stated that Javascript converts the number to a 32-bit representation when doing bitwise operations, which explains why I might be having this problem, but how can I resolve it? After some more research, I came across some Javascript bigint libraries, but I would like to do this without libraries if possible. How can I perform bitwise operations on large numbers in Javascript?