summaryrefslogtreecommitdiff
path: root/src/libstddjb/ucharn_fmt_little.c
blob: d03309668f7b9560cd44e31504801a7a70e9e69c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
/* ISC license. */

#include <sys/types.h>
#include <skalibs/fmtscan.h>

size_t ucharn_fmt_little (char *s, char const *key, size_t n)
{
  register size_t i = 0 ;
  for (; i < n ; i++)
  {
    s[i<<1] = fmtscan_asc((unsigned char)key[i] & 0xF) ;
    s[(i<<1)+1] = fmtscan_asc((unsigned char)key[i] >> 4) ;
  }
  return n << 1 ;
}