JOHNZON-15 Daniel Cunha: handle the same way byte/short/int in both writePrimitives