Avoid warnings about converting from int to bool

MSVC used to warn about this.
Add a cast when converting from int64_t to float

This avoids a warning when building with MSVC.
Merge pull request #1477 from mstorsjo/avoid-msvc-warnings

Avoid warnings when building with MSVC