I was refactoring some old code and came across the following line of code to convert bytes to GB.
decimal GB = KB / 1024 / 1024 / 1024;
Is
In theory, this is faster (precomputing the constant to do multiplication instead of division). It's probably not used often enough to matter, but just in case.
double const KbToGbFactor = 1d / 1024 /1024; double gb = kb * KbToGbFactor;