a2 / MessagePack.swift

It's like JSON, but fast and small…and Swift! – msgpack.org[Swift]

Home Page:http://msgpack.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How do I do if I want to pack small uint32 values?

dictav opened this issue · comments

Hi,

I'm trying implement MessagePack-RPC using this library. And I need to pack a value of uint32.

I have tryed,

let value = MessagePackValue(1 as UInt32)
let data = MessagePack.pack(value) //=> 0x01

But I got a fixnum instead of uint32.

How do I do if I want to pack small uint32 values?

Currently MessagePack.swift packs integers into as few bytes as possible. I would resist changing this because, instead of .Int and .UInt cases, there would need to be separate cases for each integral width (8, 16, 32, 64).