summaryrefslogtreecommitdiff
path: root/src/libbiguint/bu_fmt.c
blob: 31fa7063b22dcf2ddb580f1c0eb0896a61f37eac (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
/* ISC license. */

#include <skalibs/uint32.h>
#include <skalibs/bytestr.h>
#include <skalibs/biguint.h>

unsigned int bu_fmt (char *s, uint32 const *x, unsigned int n)
{
  unsigned int len = 0 ;
  while (n--)
  {
    char fmt[8] ;
    unsigned int i = uint32_xfmt(fmt, x[n]) ;
    byte_copy(s+len, 8-i, "00000000") ;
    byte_copy(s+len+8-i, i, fmt) ;
    len += 8 ;
  }
  return len ;
}