Optimized the execution on iPhone

Removed unnecessary switch option, optimized Math.floor with bitwise.
Math.ceil keept the same because faster than bitwise on iPhone Safari