return res;
}
-static char buf[10];
+u_int64_t
+strtox64(char *src, char **end) {
+ u_int32_t res=0, i=0;
+
+ while(src && *src && isXdigit(*src) && i<16) {
+ res = res << 4;
+ res |= str2hex[ *(unsigned char*)src ];
+ src++;
+ i++;
+ }
+
+ if ( end )
+ *end=src;
+ return res;
+}
+
+static char buf[32];
static char hex2str[]={'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'};
char*
return buf;
}
+char*
+x64tostr(u_int64_t x) {
+ char *ptr=buf;
+ int i,wast=0;
+ for(i=60;i>=0;i-=4) {
+ *ptr = hex2str[ (x>>i) & 0x0f ];
+ if ( wast || *ptr!='0' || i==0 ) {
+ ptr++;
+ wast=1;
+ }
+ }
+ *ptr='\0';
+ return buf;
+}
+
double
timediff(struct timeval *begin, struct timeval *end) {
return ((double)( end->tv_sec - begin->tv_sec )) + ( (double)( end->tv_usec-begin->tv_usec ) ) / 1.0e+6;
#include <sys/time.h>
u_int32_t strtox(char *src, char **end);
+u_int64_t strtox64(char *src, char **end);
#define atox(x) strtox((x),NULL)
char* xtostr(u_int32_t x);
+char* x64tostr(u_int64_t x);
double timediff(struct timeval *begin, struct timeval *end);
double elapsedtime(struct timeval *begin);