#include #include #include #include /*! \brief Simple timer class. */ class SimpleTimer { clock_t d_baseTime; public: SimpleTimer() : d_baseTime(clock()) {} void restart() { d_baseTime = clock(); } double elapsed() { return static_cast(clock() - d_baseTime) / CLOCKS_PER_SEC; } }; unsigned as_hex(const char* value) { unsigned x = 0; const unsigned char* ptr = (const unsigned char*)value; unsigned char b; unsigned char count = 0; while ((b = *ptr++) && (++count <= sizeof(unsigned)*2)) { x <<= 4; switch (b) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': x |= b - '0'; break; case 'A': case 'a': x |= 10; break; case 'B': case 'b': x |= 11; break; case 'C': case 'c': x |= 12; break; case 'D': case 'd': x |= 13; break; case 'E': case 'e': x |= 14; break; case 'F': case 'f': x |= 15; break; default: return 0; } } return x; } double t1_avg = 0; double t2_avg = 0; const unsigned N = 500000; static char data[N][8]; void init() { for (unsigned i=0; i