Optimzied ARM algorithm