Small code fix up

- 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
This commit is contained in:
2021-12-24 20:08:18 +01:00
parent 767dac7e73
commit 2621399349
7 changed files with 53 additions and 36 deletions

View File

@ -1,3 +1,5 @@
#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++ )
{
@ -6,3 +8,23 @@ inline void* memset (void* ptr, int value, size_t num){
}
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;
}