zz85 / space-radar

Disk And Memory Space Visualization App built with Electron & d3.js
https://github.com/zz85/space-radar-electron/releases
1.38k stars 80 forks source link

Avoid overflow errors with bigger sizes #44

Closed afbjorklund closed 3 years ago

afbjorklund commented 4 years ago

Apparently the bitwise OR operator (|) in JavaScript has some integer overflow problems over 32 bits...

This gives the wrong result on "smaller" GB sizes, and negative results (!) on "bigger" GB sizes.

It was supposed to be logical OR (||), but it is not needed since the regular expression only allows digits.

Now the results should be accurate up to the highest integer support reliably by JavaScript, i.e. 53 bits.

Partially reverts 5d711b2e986773041a09a245fca7481794c863c8