Newer
Older
ubixos / src / sys / include / misc / misc_string_conv.h
/*
   "misc_string_conv.h"

   created by: grayspace aka J. Leveille
   for: UbixOS Project
   date: July 7, 2002

   purpose: functions/macro for dealing with misc string conversion

   $Id$
*/

#ifndef _MISC_STRING_CONV_H
#define _MISC_STRING_CONV_H

extern const char a_hexvals[];

/* gets a hex value specified by a byte into a string
   but does *not* null terminate                      */
#define HEX_GETSTRING_BYTE_NONULL( p_dst_str, hexval_byte )\
         (p_dst_str)[0] = a_hexvals[((hexval_byte)>>4)];\
         (p_dst_str)[1] = a_hexvals[((hexval_byte)&0x0F)]

/* gets a hex value specified by a byte into a string */
#define HEX_GETSTRING_BYTE( p_dst_str, hexval_byte )\
         HEX_GETSTRING_BYTE_NONULL( p_dst_str, hexval_byte );\
         (p_dst_str)[2] = 0

#endif // _MISC_STRING_CONV_H