#include uint64_t getmacst(char *); uint64_t getmacst(char *s) { uint64_t mac = 0; char c; do { uint8_t byte; for (byte = 0; (c = *s++) >= '0'; byte |= c - '0') { if (c > '9') { if ((c &= ~('a' - 'A')) < 'A' || c > 'F') break; c -= 'A' - 0xA - '0'; } byte <<= 4; } mac = mac << 8 | byte; } while (c); return mac; }