aboutsummaryrefslogtreecommitdiffstats
path: root/src/include/common.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/include/common.h')
-rw-r--r--src/include/common.h12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/include/common.h b/src/include/common.h
index 7067ae68c..5a5ff67d1 100644
--- a/src/include/common.h
+++ b/src/include/common.h
@@ -64,7 +64,7 @@ static inline int atoip(const char *str, uint32_t *ip) {
64 64
65 if (sscanf(str, "%u.%u.%u.%u", &a, &b, &c, &d) != 4 || a > 255 || b > 255 || c > 255 || d > 255) 65 if (sscanf(str, "%u.%u.%u.%u", &a, &b, &c, &d) != 4 || a > 255 || b > 255 || c > 255 || d > 255)
66 return 1; 66 return 1;
67 67
68 *ip = a * 0x1000000 + b * 0x10000 + c * 0x100 + d; 68 *ip = a * 0x1000000 + b * 0x10000 + c * 0x100 + d;
69 return 0; 69 return 0;
70} 70}
@@ -91,7 +91,7 @@ static inline int atomac(char *str, unsigned char macAddr[6]) {
91 for (i = 0; i < 6; i++) { 91 for (i = 0; i < 6; i++) {
92 if (mac[i] > 0xff) 92 if (mac[i] > 0xff)
93 return 1; 93 return 1;
94 94
95 macAddr[i] = (unsigned char) mac[i]; 95 macAddr[i] = (unsigned char) mac[i];
96 } 96 }
97 97
@@ -105,16 +105,16 @@ static inline int mac_not_zero(const unsigned char mac[6]) {
105 if (mac[i] != 0) 105 if (mac[i] != 0)
106 return 1; 106 return 1;
107 } 107 }
108 108
109 return 0; 109 return 0;
110} 110}
111 111
112// rtdsc timestamp on x86-64/amd64 processors 112// rtdsc timestamp on x86-64/amd64 processors
113static inline unsigned long long getticks(void) { 113static inline unsigned long long getticks(void) {
114#if defined(__x86_64__) 114#if defined(__x86_64__)
115 unsigned a, d; 115 unsigned a, d;
116 asm volatile("rdtsc" : "=a" (a), "=d" (d)); 116 asm volatile("rdtsc" : "=a" (a), "=d" (d));
117 return ((unsigned long long)a) | (((unsigned long long)d) << 32); 117 return ((unsigned long long)a) | (((unsigned long long)d) << 32);
118#elif defined(__i386__) 118#elif defined(__i386__)
119 unsigned long long ret; 119 unsigned long long ret;
120 __asm__ __volatile__("rdtsc" : "=A" (ret)); 120 __asm__ __volatile__("rdtsc" : "=A" (ret));