repo.or.cz
/
mkp224o.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
more strict nopie check
[mkp224o.git]
/
base16_to.c
blob
9d2ee645b94d96189ca13bcd3bd6ce71b22e18ba
1
#include <stddef.h>
2
#include <stdint.h>
3
#include
"types.h"
4
#include
"base16.h"
5
6
static const char
base16t
[
16
] = {
7
'0'
,
'1'
,
'2'
,
'3'
,
8
'4'
,
'5'
,
'6'
,
'7'
,
9
'8'
,
'9'
,
'A'
,
'B'
,
10
'C'
,
'D'
,
'E'
,
'F'
,
11
};
12
13
char
*
base16_to
(
char
*
dst
,
const
u8
*
src
,
size_t
slen
)
14
{
15
for
(
size_t
i
=
0
;
i
<
slen
; ++
i
) {
16
*
dst
++ =
base16t
[
src
[
i
] >>
4
];
17
*
dst
++ =
base16t
[
src
[
i
] &
15
];
18
}
19
*
dst
=
0
;
20
return
dst
;
21
}