Skip to content
  • Matt Turner's avatar
    nir: Remove series of unnecessary conversions · 50e4099e
    Matt Turner authored
    
    
    Clang warns:
    
    warning: absolute value function 'fabsf' given an argument of type
    'const float64_t' (aka 'const double') but has parameter of type 'float'
    which may cause truncation of value [-Wabsolute-value]
    
                float64_t dst = bit_size == 64 ? fabs(src0) : fabsf(src0);
    
    The type of the ternary expression will be the common type of fabs() and
    fabsf(): double. So fabsf(src0) will be implicitly converted to double.
    We may as well just convert src0 to double before a call to fabs() and
    remove the needless complexity, à la
    
                float64_t dst = fabs(src0);
    
    Reviewed-by: default avatarEmil Velikov <emil.velikov@collabora.com>
    Reviewed-by: default avatarEric Engestrom <eric.engestrom@imgtec.com>
    50e4099e