我正在使用MessagePack for CLI (https://github.com/msgpack/msgpack-cli)库,我想知道是否可以禁用整数压缩。
例如:
// The following collection
object[] { (Int32)10, (Int32)100, (Int32)1000 };
// will look like this after unpacking
MessagePackObject[] { (Byte)10, (Byte)100, (Int16)1000 }这迫使我显式地转换集合的每一项,以便将其转换回int[],这非常耗时。
发布于 2016-10-21 19:47:40
直接使用固定大小的类型:
msgpack::sbuffer buffer;
msgpack::packer<msgpack::sbuffer> pk(&buffer);
msgpack::type::fix_uint32 code(0x00);
msgpack::type::fix_uint32 type(123);
pk.pack(code);
pk.pack(type);https://stackoverflow.com/questions/39916170
复制相似问题