summaryrefslogtreecommitdiff
path: root/src/user/knob/block.c
blob: e890fa1319cb4f287316fbaf1171cbd9400151ef (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#include <stdint.h>
#include <stdbool.h>

//unsophisticated, should copy by dwords where available
void blockcpy(void *to, const void *from, uint32_t size) {
  for (uint32_t i = 0; i < size; ++i)
    *(uint8_t *)(to++) = *(const uint8_t *)(from++);
}

//unsophisticated, should check by dwords wheere available
__attribute__ ((__pure__))
bool blockequ(void *a, void *b, uint32_t size) {
  for (uint32_t i = 0; i < size; ++i)
    if (*(uint8_t *)(a++) != *(uint8_t *)(b++))
      return false;
  return true;
}