*** empty log message ***

This commit is contained in:
hyung-hwan 2007-02-23 07:13:58 +00:00
parent 6eda269c5c
commit 4ba998a693
3 changed files with 78 additions and 1 deletions

View File

@ -1,6 +1,6 @@
OUT = asecmn OUT = asecmn
C_SRCS = str.c C_SRCS = mem.c str.c
C_OBJS = $(C_SRCS:.c=.o) C_OBJS = $(C_SRCS:.c=.o)
CC = @CC@ CC = @CC@

52
ase/cmn/mem.c Normal file
View File

@ -0,0 +1,52 @@
/*
* $Id: mem.c,v 1.1 2007-02-23 07:13:58 bacon Exp $
*
* {License}
*/
#include <ase/cmn/mem.h>
void* ase_memcpy (void* dst, const void* src, ase_size_t n)
{
void* p = dst;
void* e = (ase_byte_t*)dst + n;
while (dst < e)
{
*(ase_byte_t*)dst = *(ase_byte_t*)src;
dst = (ase_byte_t*)dst + 1;
src = (ase_byte_t*)src + 1;
}
return p;
}
void* ase_memset (void* dst, int val, ase_size_t n)
{
void* p = dst;
void* e = (ase_byte_t*)p + n;
while (p < e)
{
*(ase_byte_t*)p = (ase_byte_t)val;
p = (ase_byte_t*)p + 1;
}
return dst;
}
int ase_memcmp (const void* s1, const void* s2, ase_size_t n)
{
const void* e;
if (n == 0) return 0;
e = (const ase_byte_t*)s1 + n - 1;
while (s1 < e && *(ase_byte_t*)s1 == *(ase_byte_t*)s2)
{
s1 = (ase_byte_t*)s1 + 1;
s2 = (ase_byte_t*)s2 + 1;
}
return *((ase_byte_t*)s1) - *((ase_byte_t*)s2);
}

25
ase/cmn/mem.h Normal file
View File

@ -0,0 +1,25 @@
/*
* $Id: mem.h,v 1.1 2007-02-23 07:13:58 bacon Exp $
*
* {License}
*/
#ifndef _ASE_CMN_MEM_H_
#define _ASE_CMN_MEM_H_
#include <ase/types.h>
#include <ase/macros.h>
#ifdef __cplusplus
extern "C" {
#endif
void* ase_memcpy (void* dst, const void* src, ase_size_t n);
void* ase_memset (void* dst, int val, ase_size_t n);
int ase_memcmp (const void* s1, const void* s2, ase_size_t n);
#ifdef __cplusplus
}
#endif
#endif