- Moved memcmp function to temporary libc/mem.h - I/O functions are inlined - ATA_DEVICE read function won't print the 512 bytes by default
30 lines
650 B
C
30 lines
650 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++ )
|
|
{
|
|
int* data = (int*)ptr+ i;
|
|
*data = 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;
|
|
|
|
} |