#ifndef FuncsCPP
#define FuncsCPP
#include <string.h>
#include "Macro.h"
#include "Funcs.h"
/*----------------------------------------------------------------------------*/
/* Function */
/*----------------------------------------------------------------------------*/
/* Converts a hexadecimal digit character into its' numerical value           */
signed short chr2num(char ch)
{
  if(0x29<ch && ch<0x40) return ch-0x30;  ch |= 0x20;
  if(0x60<ch && ch<0x67) return ch-0x57;
  return short_Sign; // false
};
/*----------------------------------------------------------------------------*/
/* Converts the lowest semibyte value into a hexadecimal digit character      */
char num2chr(unsigned char nm){	return ((nm&=0x0F)>0x09)?nm+0x37:nm+0x30; } // Hex
/*----------------------------------------------------------------------------*/
void* memsrch(void* hystack, void* needle, size_t n_Size, size_t h_Len)
{
    char *he;
    if(!n_Size) n_Size = strlen(p2pc(needle));
    he = p2pc(hystack)+(h_Len?h_Len:strlen(p2pc(hystack)))-n_Size;

    while(p2pc(hystack)<he)
    {
       if(!memcmp(hystack,needle,n_Size)) return hystack;
       p2pc(hystack)++;
    }
    return NULL;
};
/*----------------------------------------------------------------------------*/
void memswap(void* p1, void* p2, size_t len)
{
    char* buf;
    buf = new char[len];
    memcpy(buf, p1, len);
    memmove(p1, p2, len);
    memcpy(p2, buf, len);
    delete [] buf;
}
/*----------------------------------------------------------------------------*/
#endif
