diff --git a/libs/microbit/core.cpp b/libs/microbit/core.cpp index 821ee4cd..1c1c8fc1 100644 --- a/libs/microbit/core.cpp +++ b/libs/microbit/core.cpp @@ -334,65 +334,3 @@ namespace ksrt { uBit.panic(code); } } - - - - namespace buffer { - - RefBuffer *mk(uint32_t size) - { - RefBuffer *r = new RefBuffer(); - r->data.resize(size); - return r; - } - - char *cptr(RefBuffer *c) - { - return (char*)&c->data[0]; - } - - int count(RefBuffer *c) { return c->data.size(); } - - void fill(RefBuffer *c, int v) - { - memset(cptr(c), v, count(c)); - } - - void fill_random(RefBuffer *c) - { - int len = count(c); - for (int i = 0; i < len; ++i) - c->data[i] = uBit.random(0x100); - } - - void add(RefBuffer *c, uint32_t x) { - c->data.push_back(x); - } - - inline bool in_range(RefBuffer *c, int x) { - return (0 <= x && x < (int)c->data.size()); - } - - uint32_t at(RefBuffer *c, int x) { - if (in_range(c, x)) { - return c->data[x]; - } - else { - error(ERR_OUT_OF_BOUNDS); - return 0; - } - } - - void set(RefBuffer *c, int x, uint32_t y) { - if (!in_range(c, x)) - return; - c->data[x] = y; - } - } - - namespace bitvm_bits { - RefBuffer *create_buffer(int size) - { - return buffer::mk(size); - } - }