KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
Is there PRIu128 that behaves similar to PRIu64 from <inttypes.h> : printf("%" PRIu64 "\n", some_uint64_value); Or converting manually digit by digit: int print_uint128(uint128_t n) { if (n == 0) return printf("0\n"); char str[40] = {0}; // log10(1 << 128) + '\0' char *s = str + sizeof(str) - 1; // start at the end while (n != 0) { if (s == str) return -1; // never happens *--s = "0123456789"[n % 10]; // save last digit n /= 10; // drop it } return printf("%s\n", s); } is the only option? Note that uint128_t is my own typedef for __uint128_t .
Tags (comma-separated)
Save Edits
Cancel