feat(util/serializer): make sure the read/write is portable

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
feat(util/serializer): make sure the read/write is portable