BarinkOS/source/lib/include/mem.h
Nigel 749f2aa492 Updating folders name's (1)
This should help merging into dev branch
2023-02-03 20:01:31 +01:00

30 lines
685 B
C

#pragma once
// NOTE: These should not be inline
inline void* memset (void* ptr, int value, size_t num){
for( int i = 0; i < num; i++ )
{
unsigned char* data = (unsigned char*)ptr+ i;
*data = (unsigned char)value;
}
return ptr;
}
inline int memcmp( const void* ptr1, const void* ptr2, size_t num)
{
const unsigned char * cs = (const unsigned char*) ptr1;
const unsigned char * ct = (const unsigned char*) ptr2;
for (int i = 0 ; i < num ; i++, cs++, ct++ ){
if( *cs < *ct){
return -1;
} else if( *cs > *ct){
return 1;
}
}
return 0;
}