You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
#include "util.h"
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Copy `num_bytes` many bytes from the `source` memory to the
|
|
|
|
* `destination` memory.
|
|
|
|
*
|
|
|
|
* @param source
|
|
|
|
* @param destination
|
|
|
|
* @param num_bytes
|
|
|
|
*/
|
|
|
|
void mem_copy(uint8_t* source, uint8_t* destination, int num_bytes) {
|
|
|
|
for ( int i = 0; i < num_bytes; i += 1 ) {
|
|
|
|
*(destination + i) = *(source + i);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void mem_set(uint8_t* destination, uint8_t value, uint32_t length) {
|
|
|
|
uint8_t* temp = (uint8_t*) destination;
|
|
|
|
while ( length != 0 ) {
|
|
|
|
*temp++ = value;
|
|
|
|
length -= 1;
|
|
|
|
}
|
|
|
|
}
|