Skip to content

Commit ebeae16

Browse files
committed
hlhl
so cool, using shorts
1 parent 4107cf6 commit ebeae16

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

src/maths/intEx.js

+15-6
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ class IntEx{
269269
this.emitting = []
270270
this.symcounter = 0
271271

272-
const lines = text.replaceAll(/\/\/.*$/gm,"").match(/(^|(?<=\;))[^;]*\w[^;]*($|(?=;))/gm).map(s=>{
272+
const lines = text.replaceAll(/\/\/.*$/gm,"").match(/(^|(?<=\;))[^;\n]*\w[^;\n]*($|(?=;))/gm).map(s=>{
273273
let str = s.replaceAll(/\s/g,"")
274274
for(let [sub, tok] of allreps){
275275
str = str.replaceAll(sub, tok);
@@ -459,9 +459,9 @@ const qcomp=(ex, bits=8)=>{
459459
let a = new IntEx(ex);
460460
let b=a.compileout();
461461
if(b[1]>=256) throw Error("Your program needs more than 256 registers. Please wait for 16-bit support.");
462-
let header = new Uint32Array([1,a.using.length,b[1],0,0])
463-
let c=[header]
464-
let offset = 20;
462+
let header = new Uint16Array([1,a.using.length,b[1],0])
463+
let c=[header, new Uint32Array([b[0].byteLength])]
464+
let offset = 12;
465465
a.using.forEach(([x,s])=>{
466466
x=x.substring(1)
467467
c.push(new Uint8Array([x.length]));
@@ -472,7 +472,16 @@ const qcomp=(ex, bits=8)=>{
472472
})
473473
c.push(b[0])
474474
header[3]=offset;
475-
header[4]=b[0].byteLength;
476-
console.log(c);
475+
console.log(c,b_cc(...c));
477476
return toB64(b_cc(...c));
478477
}
478+
479+
480+
p=`
481+
//example program
482+
//If 3 divides the channel 'left' and 'right' is greater than 5,
483+
//store the max. Otherwise, store 10.
484+
485+
$someCondition = @left%3==0 && @right>5
486+
@combine = take($someCondition, 10, max(@left,@right,30))
487+
`

0 commit comments

Comments
 (0)