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

#include <skalibs/fmtscan.h>

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