feat: packing

This commit is contained in:
cha0s 2019-09-23 19:39:01 -05:00
parent c3ec69f4ff
commit dfd2dc2a41

View File

@ -372,3 +372,14 @@ export function fromObject(object) {
export function toObject(v) { export function toObject(v) {
return {x: v[0], y: v[1]}; return {x: v[0], y: v[1]};
} }
export function unpackFromUint32(uint32) {
return [
uint32 & 0xFFFF,
uint32 >> 16,
];
}
export function packToUint32(v) {
return (v[1] << 16) | v[0];
}