Thrift-XS

 view release on metacpan or  search on metacpan

BinaryProtocol.xs  view on Meta::CPAN

  SV *tmp;
  char *tmps;
  uint64_t bits;
  RETVAL = 0;

  READ_SV(p, tmp, 8);
  tmps = SvPVX(tmp);
  RETVAL += 8;

  bits = *(uint64_t *)tmps;
  bits = ntohll(bits);

  union {
    uint64_t from;
    double to;
  } u;
  u.from = bits;

  if (SvROK(value))
    sv_setnv(SvRV(value), u.to);
}

XS.xs  view on Meta::CPAN

      | (((n) & 0x000000ff00000000ull) >> 8)  \
      | (((n) & 0x00000000ff000000ull) << 8)  \
      | (((n) & 0x0000000000ff0000ull) << 24) \
      | (((n) & 0x000000000000ff00ull) << 40) \
      | (((n) & 0x00000000000000ffull) << 56) )
#  endif
#endif

/* Define Host/Network macros */
#if __BYTE_ORDER == __BIG_ENDIAN
#  define ntohll(n)  (n)
#  define htonll(n)  (n)
#  define htolell(n) bswap_64(n)
#  define letohll(n) bswap_64(n)
#else
#  define ntohll(n)  bswap_64(n)
#  define htonll(n)  bswap_64(n)
#  define htolell(n) (n)
#  define letohll(n) (n)
#endif

MODULE = Thrift::XS		PACKAGE = Thrift::XS		
PROTOTYPES: ENABLE

INCLUDE: MemoryBuffer.xs
INCLUDE: BinaryProtocol.xs



( run in 2.786 seconds using v1.01-cache-2.11-cpan-5e09290becf )