-
Notifications
You must be signed in to change notification settings - Fork 0
/
Utility.c
44 lines (36 loc) · 855 Bytes
/
Utility.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#include "Utility.h"
/**
* 메모리를 특정 값으로 채움
*/
void kMemSet( void* pvDestination, BYTE bData, int iSize )
{
int i;
// 8 바이트씩 먼저 채움
for( i = 0 ; i < iSize ; i++ )
{
( ( char* ) pvDestination )[ i ] = bData;
}
}
int kMemCpy( void* pvDestination, const void* pvSource, int iSize )
{
int i;
for( i = 0 ; i < iSize ; i++ )
{
( ( char* ) pvDestination )[ i ] = ( ( char* ) pvSource )[ i ];
}
return iSize;
}
int kMemCmp( const void* pvDestination, const void* pvSource, int iSize )
{
int i;
char cTemp;
for( i = 0 ; i < iSize ; i++ )
{
cTemp = ( ( char* ) pvDestination )[ i ] - ( ( char* ) pvSource )[ i ];
if( cTemp != 0 )
{
return ( int ) cTemp;
}
}
return 0;
}