Speed up toInteger by using simple operators

Fixes #13.