Refactor utils.h for readability

Give code some consistency and flip if-else statements in `int xtoi()` to enhance readability and performance.