PNaCl: refactor implementation of arithmetic operations