/*
 * Document-method: Hash#to_msgpack
 *
 * call-seq:
 *   hash.to_msgpack(out = '') -> String
 *
 * Serializes the Hash into raw bytes.
 * This calls to_msgpack method reflectively for internal keys and values.
 */
static VALUE MessagePack_Hash_to_msgpack(int argc, VALUE *argv, VALUE self)
{
        ARG_BUFFER(out, argc, argv);
        // FIXME check sizeof(st_index_t) > sizeof(unsigned int) && RARRAY_LEN(self) > UINT_MAX
        msgpack_pack_map(out, (unsigned int)RHASH_SIZE(self));
        rb_hash_foreach(self, MessagePack_Hash_to_msgpack_foreach, out);
        return out;
}