buffer: optimize writeInt* methods

Remove unnecessary encoding within writeInt*