Fix a cast warning when compiling with MSVC

Would previously give a C4800 warning.