bad char
[vg.git] / vg_binstr.h
index d6bfb83b40cff72b75352226a89b9c816d851800..6e662fe3f33dd11f04e74b813fdd6297fd2ff675 100644 (file)
@@ -1,32 +1,10 @@
-#ifndef VG_BINSTR
-#define VG_BINSTR
+#pragma once
 
 /* dead simple.. 4 bits/character encoding */
 
-#include "vg_stdint.h"
+#include "vg_platform.h"
 
 #define VG_BINSTR_BASECHAR 0x41
 
-static void vg_str_bin( const void *txt, void *bin, int size )
-{
-   const u8 *src = txt;
-         u8 *dst = bin;
-
-   for( u32 i=0; i<size/2; i++ ){
-      dst[i]  = (src[i*2+0]-VG_BINSTR_BASECHAR);
-      dst[i] |= (src[i*2+1]-VG_BINSTR_BASECHAR)<<4u;
-   }
-}
-
-static void vg_bin_str( const void *bin, void *txt, u32 size )
-{
-         u8 *dst = txt;
-   const u8 *src = bin;
-
-   for( u32 i=0; i<size; i++ ){
-      dst[i*2+0] = VG_BINSTR_BASECHAR + ((src[i]    ) & 0xf);
-      dst[i*2+1] = VG_BINSTR_BASECHAR + ((src[i]>>4u) & 0xf);
-   }
-}
-
-#endif /* VG_BINSTR */
+void vg_str_bin( const void *txt, void *bin, int size );
+void vg_bin_str( const void *bin, void *txt, u32 size );