The three bits of code here are new algorithms and are significantly faster than the previous.    They are also correct where-as various inputs on the old algorithm would actually return a different result as compared to the scalar versions.