use std::size_t
This commit is contained in:
@ -1,7 +1,7 @@
|
||||
#include "Memory.h"
|
||||
|
||||
void bse::memset(char* destination, const char value, const unsigned int bytes) {
|
||||
for (unsigned int byte = 0; byte < bytes; ++byte) {
|
||||
void bse::memset(char* destination, const char value, std::size_t bytes) {
|
||||
for (std::size_t byte = 0; byte < bytes; ++byte) {
|
||||
*(destination + byte) = value;
|
||||
}
|
||||
}
|
||||
|
@ -1,26 +1,26 @@
|
||||
#ifndef MYSTDLIB_INCLUDE_H_
|
||||
#define MYSTDLIB_INCLUDE_H_
|
||||
|
||||
#include <utility>
|
||||
|
||||
namespace bse {
|
||||
|
||||
// add using byte or sth to replace char
|
||||
|
||||
template<typename T>
|
||||
void memcpy(T* destination, const T* source, const unsigned int count = 1) {
|
||||
void memcpy(T* destination, const T* source, std::size_t count = 1) {
|
||||
for (unsigned int i = 0; i < count; ++i) {
|
||||
*(destination + i) = *(source + i);
|
||||
}
|
||||
}
|
||||
|
||||
void memset(char* destination, char value, unsigned int bytes);
|
||||
void memset(char* destination, char value, std::size_t bytes);
|
||||
|
||||
template<typename T>
|
||||
void zero(T* destination) {
|
||||
memset(reinterpret_cast<char*>(destination), '\0', sizeof(T));
|
||||
}
|
||||
|
||||
// void strcpy(char* destination, char* source);
|
||||
// unsigned int strlen(char* string);
|
||||
} // namespace bse
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user