#include void putmacst(uint64_t, char *); void putmacst(uint64_t mac, char *s) { for (int i = 0; i < 12; i++) { char digit = mac >> 44 & 0xF; mac <<= 4; if ((digit += '0') > '9') digit += 'A' - 0xA - '0'; *s++ = digit; if (i & 1) *s++ = '-'; } *--s = '\0'; }