Optimized for execution on iPhone Safari

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