• jdduke@chromium.org's avatar
    Optimize QuadF's PointIsInTriangle function · b63a661d
    jdduke@chromium.org authored
    The original version required 34 float ops (16mul + 11sub + 5add + 2div).
    This version removes some of the intermediate dot products, reducing the
    max number of operations to 19 (6mul + 2div + 11sub).  It also avoids using
    doubles, warranted by the removal of several intermediate operations that might
    otherwise incur significance loss.
    
    In local (release build) benchmarks, this reduced the typical CPU cost of a call to
    QuadF::Contains(...) by 2/3, both with GCC and Clang on an ARM v7 device.
    
    Review URL: https://codereview.chromium.org/291493003
    
    git-svn-id: svn://svn.chromium.org/chrome/trunk/src@271088 0039d316-1c4b-4281-b951-d872f2087c98
    b63a661d
quad_f.cc 3.9 KB