Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 2nd, 2012  |  syntax: None  |  size: 0.40 KB  |  hits: 18  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. #ifndef RBIGNUM_SIGN  // Ruby 1.8
  2. #define RBIGNUM_SIGN(b) (RBIGNUM(b)->sign)
  3. #endif
  4.  
  5. static VALUE MessagePack_Bignum_to_msgpack(int argc, VALUE *argv, VALUE self)
  6. {
  7.   ARG_BUFFER(out, argc, argv);
  8.   // FIXME bignum
  9.   if(RBIGNUM_SIGN(self)) {  // positive
  10.     msgpack_pack_uint64(out, rb_big2ull(self));
  11.   } else {  // negative
  12.     msgpack_pack_int64(out, rb_big2ll(self));
  13.   }
  14.   return out;
  15. }