ucspi-ssl  0.99e
TLS encryption for IPv6 communication
fmt_xlong.c
Go to the documentation of this file.
1 #include "fmt.h"
2 #include "hexconversion.h"
3 
4 unsigned int fmt_xlong(register char *s,register unsigned long u)
5 {
6  register unsigned int len; register unsigned long q;
7  len = 1; q = u;
8  while (q > 15) { ++len; q /= 16; }
9  if (s) {
10  s += len;
11  do { *--s = tohex(u % 16); u /= 16; } while(u); /* handles u == 0 */
12  }
13  return len;
14 }
char tohex(char num)
Definition: hexconversion.c:23
unsigned int fmt_xlong(register char *s, register unsigned long u)
Definition: fmt_xlong.c:4