aboutsummaryrefslogtreecommitdiff
path: root/src/std/buffer_view.c
blob: f2d79c0f57665d323b3c6bf3127da2fbf4d5cfe1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include "../../include/std/buffer_view.h"
#include "../../include/std/mem.h"

BufferView create_buffer_view_null() {
    BufferView buffer_view;
    buffer_view.data = NULL;
    buffer_view.size = 0;
    return buffer_view;
}

BufferView create_buffer_view(const char *data, usize size) {
    BufferView buffer_view;
    buffer_view.data = data;
    buffer_view.size = size;
    return buffer_view;
}

bool buffer_view_equals(const BufferView *self, const BufferView *other) {
    return self->size == other->size && am_memeql(self->data, other->data, self->size);
}