Grid, code cleanup:
Merged if statements.
Replaced magic number 65535.0f with const float MaxUShortFloat =
std::numeric_limits <unsigned short>::max ();.
Use prefix- instead of postfix-increment.
Removed redundant (float) casts.
Removed redundant brackets.
Added and removed newlines to improve readability.
Minor indentation fixes.
Approved by PS Jenkins bot, Sam Spilsbury.