d6bfb83b40cff72b75352226a89b9c816d851800
4 /* dead simple.. 4 bits/character encoding */
8 #define VG_BINSTR_BASECHAR 0x41
10 static void vg_str_bin( const void *txt
, void *bin
, int size
)
15 for( u32 i
=0; i
<size
/2; i
++ ){
16 dst
[i
] = (src
[i
*2+0]-VG_BINSTR_BASECHAR
);
17 dst
[i
] |= (src
[i
*2+1]-VG_BINSTR_BASECHAR
)<<4u;
21 static void vg_bin_str( const void *bin
, void *txt
, u32 size
)
26 for( u32 i
=0; i
<size
; i
++ ){
27 dst
[i
*2+0] = VG_BINSTR_BASECHAR
+ ((src
[i
] ) & 0xf);
28 dst
[i
*2+1] = VG_BINSTR_BASECHAR
+ ((src
[i
]>>4u) & 0xf);
32 #endif /* VG_BINSTR */