da41ce041a74881a01c9b63409ba6cc5a853f591
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
++ )
17 dst
[i
] = (src
[i
*2+0]-VG_BINSTR_BASECHAR
);
18 dst
[i
] |= (src
[i
*2+1]-VG_BINSTR_BASECHAR
)<<4u;
22 static void vg_bin_str( const void *bin
, void *txt
, u32 size
)
27 for( u32 i
=0; i
<size
; i
++ )
29 dst
[i
*2+0] = VG_BINSTR_BASECHAR
+ ((src
[i
] ) & 0xf);
30 dst
[i
*2+1] = VG_BINSTR_BASECHAR
+ ((src
[i
]>>4u) & 0xf);
34 #endif /* VG_BINSTR */