fix msvs 'static_cast' warning

the msvs compiler does not allow us to use static_cast to get from
'double' to 'enum'. You have to explicitly cast the double to int before
casting it to an enum.