Skip to content

Instantly share code, notes, and snippets.

@rogerpoon
Created July 28, 2017 20:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rogerpoon/0de07f99b71fa36c716451066dca5e6d to your computer and use it in GitHub Desktop.
Save rogerpoon/0de07f99b71fa36c716451066dca5e6d to your computer and use it in GitHub Desktop.
import System;
external Uint8Array;
class ByteArray
{
var stack;
ByteArray(int size) {
this.stack = new Uint8Array(size);
}
byte get(int index) {
return stack[index];
}
byte set(int index, byte value) {
return stack[index] = value;
}
property int length() {
return stack.length;
}
}
ByteArray b = new ByteArray(1);
b.set(0, 255);
Console.log(b.get(0));
Console.log(b.length);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment