On 09/18/2012 05:23 PM, Max Filippov wrote:
> +uint32_t HELPER(ftoi)(float32 v, uint32_t rounding_mode, uint32_t scale)
> +{
> +    float_status fp_status = {0};
> +
> +    set_float_rounding_mode(rounding_mode, &fp_status);
> +    return float32_to_int32(
> +            float32_scalbn(v, scale, &fp_status), &fp_status);
> +}
> +
> +uint32_t HELPER(ftoui)(float32 v, uint32_t rounding_mode, uint32_t scale)
> +{
> +    float_status fp_status = {0};
> +    float32 res;
> +
> +    set_float_rounding_mode(rounding_mode, &fp_status);
> +
> +    res = float32_scalbn(v, scale, &fp_status);
> +
> +    if (float32_is_neg(v) && !float32_is_any_nan(v)) {
> +        return float32_to_int32(res, &fp_status);
> +    } else {
> +        return float32_to_uint32(res, &fp_status);
> +    }
> +}

Are you really intending to discard any exceptions raised here?


r~

Reply via email to