renamings
This commit is contained in:
7
c_os/user/lib/MyLib.cc
Executable file
7
c_os/user/lib/MyLib.cc
Executable file
@ -0,0 +1,7 @@
|
||||
#include "user/lib/MyLib.h"
|
||||
|
||||
void mmem::memset(char* destination, char value, unsigned int bytes) {
|
||||
for (unsigned int byte = 0; byte < bytes; ++byte) {
|
||||
*(destination + byte) = value;
|
||||
}
|
||||
}
|
||||
23
c_os/user/lib/MyLib.h
Executable file
23
c_os/user/lib/MyLib.h
Executable file
@ -0,0 +1,23 @@
|
||||
#ifndef __MYSTDLIB_INCLUDE_H_
|
||||
#define __MYSTDLIB_INCLUDE_H_
|
||||
|
||||
namespace mmem {
|
||||
template<typename T>
|
||||
void memcpy(T* destination, T* source, unsigned int count = 1) {
|
||||
for (unsigned int i = 0; i < count; ++i) {
|
||||
*(destination + i) = *(source + i);
|
||||
}
|
||||
}
|
||||
|
||||
void memset(char* destination, char value, unsigned int bytes);
|
||||
|
||||
template<typename T>
|
||||
void zero(T* destination) {
|
||||
mmem::memset((char*)destination, '\0', sizeof(T));
|
||||
}
|
||||
|
||||
// void strcpy(char* destination, char* source);
|
||||
// unsigned int strlen(char* string);
|
||||
} // namespace mmem
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user