Newer
Older
Scratch / lockwasher / src / sys / include / misc / misc_string_conv.h
@Christopher W. Olsen Christopher W. Olsen on 25 Oct 2019 869 bytes Scratch
/*
   "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: misc_string_conv.h,v 1.1.1.1 2003/01/12 00:20:19 reddawg Exp $
*/

#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