#include "gats/integer.h" #include #include #include using namespace Bu; void hexdump( char *dat, int iSize ) { static const char *hex="0123456789ABCDEF"; printf("----\n"); for( int j = 0; j < iSize; j += 8 ) { for( int k = j; /*k < iSize &&*/ k < j+8; k++ ) printf((k>4)&0x0F], hex[dat[k]&0x0F] ); printf("| "); for( int k = j; k < iSize && k < j+8; k++ ) printf("%c ", (dat[k]>13&&dat[k]<127)?(dat[k]):('.') ); printf("\n"); } printf("----\n"); } int main( int argc, char *argv[] ) { for( int j = 1; j < argc; j++ ) { int64_t i = strtoll( argv[j], NULL, 10 ); MemBuf mb; Gats::Integer::writePackedInt( mb, i ); hexdump( mb.getString().getStr(), mb.getString().getSize() ); } /* sio << "Before: " << i << sio.nl; Gats::Integer::writePackedInt( mb, i ); mb.write("aaa", 3 ); mb.setPos( 0 ); Gats::Integer::readPackedInt( mb, i ); sio << "After: " << i << sio.nl; char buf[4]; buf[mb.read( buf, 3 )] = '\0'; sio << "Extra: \"" << buf << "\"" << sio.nl; */ return 0; }