Created
June 18, 2010 15:18
-
-
Save bcg/443770 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef RBIGNUM_SIGN // Ruby 1.8 | |
#define RBIGNUM_SIGN(b) (RBIGNUM(b)->sign) | |
#endif | |
static VALUE MessagePack_Bignum_to_msgpack(int argc, VALUE *argv, VALUE self) | |
{ | |
ARG_BUFFER(out, argc, argv); | |
// FIXME bignum | |
if(RBIGNUM_SIGN(self)) { // positive | |
msgpack_pack_uint64(out, rb_big2ull(self)); | |
} else { // negative | |
msgpack_pack_int64(out, rb_big2ll(self)); | |
} | |
return out; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment