- case BE_UNS64: { /* idea borrowed from by Marshall Rose */
- double d;
- int j, carry;
- char *cpf, *cpl, last[6], first[30];
- if (elem->data.uns64.high == 0) {
- ND_PRINT((ndo, "%u", elem->data.uns64.low));
- break;
- }
- d = elem->data.uns64.high * 4294967296.0; /* 2^32 */
- if (elem->data.uns64.high <= 0x1fffff) {
- d += elem->data.uns64.low;
-#if 0 /*is looks illegal, but what is the intention?*/
- ND_PRINT((ndo, "%.f", d));
-#else
- ND_PRINT((ndo, "%f", d));
-#endif
- break;
- }
- d += (elem->data.uns64.low & 0xfffff000);
-#if 0 /*is looks illegal, but what is the intention?*/
- snprintf(first, sizeof(first), "%.f", d);
-#else
- snprintf(first, sizeof(first), "%f", d);
-#endif
- snprintf(last, sizeof(last), "%5.5d",
- elem->data.uns64.low & 0xfff);
- for (carry = 0, cpf = first+strlen(first)-1, cpl = last+4;
- cpl >= last;
- cpf--, cpl--) {
- j = carry + (*cpf - '0') + (*cpl - '0');
- if (j > 9) {
- j -= 10;
- carry = 1;
- } else {
- carry = 0;
- }
- *cpf = j + '0';
- }
- ND_PRINT((ndo, "%s", first));