13xforever / ps3-disc-dumper

A handy utility to make decrypted PS3 disc dumps
MIT License
439 stars 29 forks source link

Update StorageUnits.cs #1

Closed dio-gh closed 5 years ago

dio-gh commented 5 years ago

Sorry, I couldn't resist :P

On a more serious note, I'm fine with either of the nomenclatures, but mixing them is not a good idea. And by that I mean that you filled in 1000 as the kilobyte limit, but used 1024 everywhere else, including where the actual counting happened. This resulted in 1000 bytes being printed out as "0.97 KB", which I'm fairly sure was not the design goal, even if you prefer KB' over KiB'.

I'm also not terribly sure why haven't you just casted the limits to doubles and used them for the divisions, or better yet, just made them doubles to begin with, but what do I know ¯_(ツ)_/¯. I did correct all the output strings to use binary prefixes though, but if you don't like them, I'll revert those gladly.

:popcorn:

13xforever commented 5 years ago

Limit under 1000 units strict is meant to have output values to contain 3 digits, and scale to higher prefix a bit earlier for this reason, so you have 999 MB, but then 0.98 GB, which is a more natural readout for most people (e.g. see how Windows does this). So yes, it is very much by design.

Also there's no reason to explicitly cast to doubles, as one of the arguments is a double, so compiler will implicitly convert everything anyway.

Binary prefixes should burn in hell, just like the HDD manufacturers who started this nonsense to begin with. Computer science always used base-2 for memory nomenclature, there's literally 0 reasons to move to base-10 and then track what systems use what for what.