Skip to content
  • Neil Roberts's avatar
    glsl/lower_precision: Use vector.back() instead of vector.end()[-1] · 63b4fcba
    Neil Roberts authored
    
    
    The use of vector.end()[-1] seems to generate warnings in Coverity about
    not allowing a negative argument to a parameter. The intention with the
    code snippet is just to access the last element of the vector. The
    vector.back() call acheives the same thing, is clearer and will
    hopefully fix the Coverity warning.
    
    I’m not exactly sure why Coverity thinks the array index can’t be
    negative. cplusplus.com says that vector::end() returns a random access
    iterator and that the type of the array index operator argument to that
    should be the difference type for the container. It then also says that
    difference_type for a vector is "a signed integral type".
    
    Reviewed-by: default avatarEric Anholt <eric@anholt.net>
    63b4fcba