@@ -95,45 +95,87 @@ VAL idris_b8SDiv(VM *vm, VAL a, VAL b) {
95 return cl;
95 return cl;
98−VAL idris_b8Z16(VM *vm, VAL a) {
98+VAL idris_b8Lt(VM *vm, VAL a, VAL b) {
99 VAL cl = allocate(vm, sizeof(Closure), 0);
99 VAL cl = allocate(vm, sizeof(Closure), 0);
100− SETTY(cl, BITS16);
100+ SETTY(cl, BITS8);
101− cl->info.bits16 = (uint16_t) a->info.bits8;
101+ cl->info.bits8 = a->info.bits8 < b->info.bits8;
102 return cl;
102 return cl;
105−VAL idris_b8Z32(VM *vm, VAL a) {
105+VAL idris_b8Gt(VM *vm, VAL a, VAL b) {
106 VAL cl = allocate(vm, sizeof(Closure), 0);
106 VAL cl = allocate(vm, sizeof(Closure), 0);
107− SETTY(cl, BITS32);
107+ SETTY(cl, BITS8);
108− cl->info.bits32 = (uint32_t) a->info.bits8;
108+ cl->info.bits8 = a->info.bits8 > b->info.bits8;
109 return cl;
109 return cl;
112−VAL idris_b8Z64(VM *vm, VAL a) {
112+VAL idris_b8Eq(VM *vm, VAL a, VAL b) {
113 VAL cl = allocate(vm, sizeof(Closure), 0);
113 VAL cl = allocate(vm, sizeof(Closure), 0);
114− SETTY(cl, BITS16);
114+ SETTY(cl, BITS8);
115− cl->info.bits64 = (uint64_t) a->info.bits8;
115+ cl->info.bits8 = a->info.bits8 == b->info.bits8;
116 return cl;
116 return cl;
119−VAL idris_b8S16(VM *vm, VAL a) {
119+VAL idris_b8Lte(VM *vm, VAL a, VAL b) {
120 VAL cl = allocate(vm, sizeof(Closure), 0);
120 VAL cl = allocate(vm, sizeof(Closure), 0);
121− SETTY(cl, BITS16);
121+ SETTY(cl, BITS8);
122− cl->info.bits16 = (uint16_t) (int16_t) (int8_t) a->info.bits8;
122+ cl->info.bits8 = a->info.bits8 <= b->info.bits8;
123 return cl;
123 return cl;
126−VAL idris_b8S32(VM *vm, VAL a) {
126+VAL idris_b8Gte(VM *vm, VAL a, VAL b) {
127 VAL cl = allocate(vm, sizeof(Closure), 0);
127 VAL cl = allocate(vm, sizeof(Closure), 0);
128− SETTY(cl, BITS32);
128+ SETTY(cl, BITS8);
129− cl->info.bits32 = (uint32_t) (int32_t) (int8_t) a->info.bits8;
129+ cl->info.bits8 = a->info.bits8 >= b->info.bits8;
130 return cl;
130 return cl;
133−VAL idris_b8S64(VM *vm, VAL a) {
133+VAL idris_b8Compl(VM *vm, VAL a) {
134 VAL cl = allocate(vm, sizeof(Closure), 0);
134 VAL cl = allocate(vm, sizeof(Closure), 0);
135− SETTY(cl, BITS64);
135+ SETTY(cl, BITS8);
136− cl->info.bits64 = (uint64_t) (int64_t) (int8_t) a->info.bits8;
136+ cl->info.bits8 = ~ a->info.bits8;
140+VAL idris_b8And(VM *vm, VAL a, VAL b) {
141+ VAL cl = allocate(vm, sizeof(Closure), 0);
143+ cl->info.bits8 = a->info.bits8 & b->info.bits8;
147+VAL idris_b8Or(VM *vm, VAL a, VAL b) {
148+ VAL cl = allocate(vm, sizeof(Closure), 0);
150+ cl->info.bits8 = a->info.bits8 | b->info.bits8;
154+VAL idris_b8Xor(VM *vm, VAL a, VAL b) {
155+ VAL cl = allocate(vm, sizeof(Closure), 0);
157+ cl->info.bits8 = a->info.bits8 ^ b->info.bits8;
161+VAL idris_b8Shl(VM *vm, VAL a, VAL b) {
162+ VAL cl = allocate(vm, sizeof(Closure), 0);
164+ cl->info.bits8 = a->info.bits8 << b->info.bits8;
168+VAL idris_b8LShr(VM *vm, VAL a, VAL b) {
169+ VAL cl = allocate(vm, sizeof(Closure), 0);
171+ cl->info.bits8 = a->info.bits8 >> b->info.bits8;
175+VAL idris_b8AShr(VM *vm, VAL a, VAL b) {
176+ VAL cl = allocate(vm, sizeof(Closure), 0);
178+ cl->info.bits8 = (uint8_t) (((int8_t)a->info.bits8) >> ((int8_t)b->info.bits8));
137 return cl;
179 return cl;
@@ -169,42 +211,91 @@ VAL idris_b16SDiv(VM *vm, VAL a, VAL b) {
169 VAL cl = allocate(vm, sizeof(Closure), 0);
211 VAL cl = allocate(vm, sizeof(Closure), 0);
170 SETTY(cl, BITS16);
212 SETTY(cl, BITS16);
171 cl->info.bits16 =
213 cl->info.bits16 =
172− (uint16_t) (((int16_t) a->info.bits16) / ((int16_t) b->info.bits16));
214+ (uint16_t) (((int16_t) a->info.bits16) / ((int16_t) b->info.bits16));
173 return cl;
215 return cl;
176−VAL idris_b16Z32(VM *vm, VAL a) {
218+VAL idris_b16Lt(VM *vm, VAL a, VAL b) {
177 VAL cl = allocate(vm, sizeof(Closure), 0);
219 VAL cl = allocate(vm, sizeof(Closure), 0);
178− SETTY(cl, BITS32);
220+ SETTY(cl, BITS16);
179− cl->info.bits32 = (uint32_t) a->info.bits16;
221+ cl->info.bits16 = a->info.bits16 < b->info.bits16;
180 return cl;
222 return cl;
183−VAL idris_b16Z64(VM *vm, VAL a) {
225+VAL idris_b16Gt(VM *vm, VAL a, VAL b) {
184 VAL cl = allocate(vm, sizeof(Closure), 0);
226 VAL cl = allocate(vm, sizeof(Closure), 0);
185− SETTY(cl, BITS64);
227+ SETTY(cl, BITS16);
186− cl->info.bits64 = (uint64_t) a->info.bits16;
228+ cl->info.bits16 = a->info.bits16 > b->info.bits16;
187 return cl;
229 return cl;
190−VAL idris_b16S32(VM *vm, VAL a) {
232+VAL idris_b16Eq(VM *vm, VAL a, VAL b) {
191 VAL cl = allocate(vm, sizeof(Closure), 0);
233 VAL cl = allocate(vm, sizeof(Closure), 0);
192− SETTY(cl, BITS32);
234+ SETTY(cl, BITS16);
193− cl->info.bits32 = (uint32_t) (int32_t) (int16_t) a->info.bits16;
235+ cl->info.bits16 = a->info.bits16 == b->info.bits16;
194 return cl;
236 return cl;
197−VAL idris_b16S64(VM *vm, VAL a) {
239+VAL idris_b16Lte(VM *vm, VAL a, VAL b) {
198 VAL cl = allocate(vm, sizeof(Closure), 0);
240 VAL cl = allocate(vm, sizeof(Closure), 0);
199− SETTY(cl, BITS64);
241+ SETTY(cl, BITS16);
200− cl->info.bits64 = (uint64_t) (int64_t) (int16_t) a->info.bits16;
242+ cl->info.bits16 = a->info.bits16 <= b->info.bits16;
201 return cl;
243 return cl;
204−VAL idris_b16T8(VM *vm, VAL a) {
246+VAL idris_b16Gte(VM *vm, VAL a, VAL b) {
205 VAL cl = allocate(vm, sizeof(Closure), 0);
247 VAL cl = allocate(vm, sizeof(Closure), 0);
206− SETTY(cl, BITS8);
248+ SETTY(cl, BITS16);
249+ cl->info.bits16 = a->info.bits16 >= b->info.bits16;
253+VAL idris_b16Compl(VM *vm, VAL a) {
254+ VAL cl = allocate(vm, sizeof(Closure), 0);
207− cl->info.bits8 = (uint8_t) a->info.bits16;
256+ cl->info.bits16 = ~ a->info.bits16;
260+VAL idris_b16And(VM *vm, VAL a, VAL b) {
261+ VAL cl = allocate(vm, sizeof(Closure), 0);
263+ cl->info.bits16 = a->info.bits16 & b->info.bits16;
267+VAL idris_b16Or(VM *vm, VAL a, VAL b) {
268+ VAL cl = allocate(vm, sizeof(Closure), 0);
270+ cl->info.bits16 = a->info.bits16 | b->info.bits16;
274+VAL idris_b16Xor(VM *vm, VAL a, VAL b) {
275+ VAL cl = allocate(vm, sizeof(Closure), 0);
277+ cl->info.bits16 = a->info.bits16 ^ b->info.bits16;
281+VAL idris_b16Shl(VM *vm, VAL a, VAL b) {
282+ VAL cl = allocate(vm, sizeof(Closure), 0);
284+ cl->info.bits16 = a->info.bits16 << b->info.bits16;
288+VAL idris_b16LShr(VM *vm, VAL a, VAL b) {
289+ VAL cl = allocate(vm, sizeof(Closure), 0);
291+ cl->info.bits16 = a->info.bits16 >> b->info.bits16;
295+VAL idris_b16AShr(VM *vm, VAL a, VAL b) {
296+ VAL cl = allocate(vm, sizeof(Closure), 0);
298+ cl->info.bits16 = (uint16_t) (((int16_t)a->info.bits16) >> ((int16_t)b->info.bits16));
208 return cl;
299 return cl;
@@ -240,35 +331,91 @@ VAL idris_b32SDiv(VM *vm, VAL a, VAL b) {
240 VAL cl = allocate(vm, sizeof(Closure), 0);
331 VAL cl = allocate(vm, sizeof(Closure), 0);
241 SETTY(cl, BITS32);
332 SETTY(cl, BITS32);
242 cl->info.bits32 =
333 cl->info.bits32 =
243− (uint32_t) (((int32_t) a->info.bits32) / ((int32_t) b->info.bits32));
334+ (uint32_t) (((int32_t) a->info.bits32) / ((int32_t) b->info.bits32));
244 return cl;
335 return cl;
247−VAL idris_b32Z64(VM *vm, VAL a) {
338+VAL idris_b32Lt(VM *vm, VAL a, VAL b) {
248 VAL cl = allocate(vm, sizeof(Closure), 0);
339 VAL cl = allocate(vm, sizeof(Closure), 0);
249− SETTY(cl, BITS64);
340+ SETTY(cl, BITS32);
250− cl->info.bits64 = (uint64_t) a->info.bits32;
341+ cl->info.bits32 = a->info.bits32 < b->info.bits32;
251 return cl;
342 return cl;
254−VAL idris_b32S64(VM *vm, VAL a) {
345+VAL idris_b32Gt(VM *vm, VAL a, VAL b) {
255 VAL cl = allocate(vm, sizeof(Closure), 0);
346 VAL cl = allocate(vm, sizeof(Closure), 0);
256− SETTY(cl, BITS64);
347+ SETTY(cl, BITS32);
257− cl->info.bits64 = (uint64_t) (int64_t) (int32_t) a->info.bits32;
348+ cl->info.bits32 = a->info.bits32 > b->info.bits32;
258 return cl;
349 return cl;
261−VAL idris_b32T8(VM *vm, VAL a) {
352+VAL idris_b32Eq(VM *vm, VAL a, VAL b) {
262 VAL cl = allocate(vm, sizeof(Closure), 0);
353 VAL cl = allocate(vm, sizeof(Closure), 0);
263− SETTY(cl, BITS8);
354+ SETTY(cl, BITS32);
264− cl->info.bits8 = (uint8_t) a->info.bits32;
355+ cl->info.bits32 = a->info.bits32 == b->info.bits32;
265 return cl;
356 return cl;
268−VAL idris_b32T16(VM *vm, VAL a) {
359+VAL idris_b32Lte(VM *vm, VAL a, VAL b) {
269 VAL cl = allocate(vm, sizeof(Closure), 0);
360 VAL cl = allocate(vm, sizeof(Closure), 0);
270− SETTY(cl, BITS16);
361+ SETTY(cl, BITS32);
271− cl->info.bits16 = (uint16_t) a->info.bits32;
362+ cl->info.bits32 = a->info.bits32 <= b->info.bits32;
366+VAL idris_b32Gte(VM *vm, VAL a, VAL b) {
367+ VAL cl = allocate(vm, sizeof(Closure), 0);
369+ cl->info.bits32 = a->info.bits32 >= b->info.bits32;
373+VAL idris_b32Compl(VM *vm, VAL a) {
374+ VAL cl = allocate(vm, sizeof(Closure), 0);
376+ cl->info.bits32 = ~ a->info.bits32;
380+VAL idris_b32And(VM *vm, VAL a, VAL b) {
381+ VAL cl = allocate(vm, sizeof(Closure), 0);
383+ cl->info.bits32 = a->info.bits32 & b->info.bits32;
387+VAL idris_b32Or(VM *vm, VAL a, VAL b) {
388+ VAL cl = allocate(vm, sizeof(Closure), 0);
390+ cl->info.bits32 = a->info.bits32 | b->info.bits32;
394+VAL idris_b32Xor(VM *vm, VAL a, VAL b) {
395+ VAL cl = allocate(vm, sizeof(Closure), 0);
397+ cl->info.bits32 = a->info.bits32 ^ b->info.bits32;
401+VAL idris_b32Shl(VM *vm, VAL a, VAL b) {
402+ VAL cl = allocate(vm, sizeof(Closure), 0);
404+ cl->info.bits32 = a->info.bits32 << b->info.bits32;
408+VAL idris_b32LShr(VM *vm, VAL a, VAL b) {
409+ VAL cl = allocate(vm, sizeof(Closure), 0);
411+ cl->info.bits32 = a->info.bits32 >> b->info.bits32;
415+VAL idris_b32AShr(VM *vm, VAL a, VAL b) {
416+ VAL cl = allocate(vm, sizeof(Closure), 0);
418+ cl->info.bits32 = (uint32_t) (((int32_t)a->info.bits32) >> ((int32_t)b->info.bits32));
272 return cl;
419 return cl;
@@ -304,7 +451,196 @@ VAL idris_b64SDiv(VM *vm, VAL a, VAL b) {
304 VAL cl = allocate(vm, sizeof(Closure), 0);
451 VAL cl = allocate(vm, sizeof(Closure), 0);
305 SETTY(cl, BITS64);
452 SETTY(cl, BITS64);
306 cl->info.bits64 =
453 cl->info.bits64 =
307− (uint64_t) (((int64_t) a->info.bits64) / ((int64_t) b->info.bits64));
454+ (uint64_t) (((int64_t) a->info.bits64) / ((int64_t) b->info.bits64));
458+VAL idris_b64Lt(VM *vm, VAL a, VAL b) {
459+ VAL cl = allocate(vm, sizeof(Closure), 0);
461+ cl->info.bits64 = a->info.bits64 < b->info.bits64;
465+VAL idris_b64Gt(VM *vm, VAL a, VAL b) {
466+ VAL cl = allocate(vm, sizeof(Closure), 0);
468+ cl->info.bits64 = a->info.bits64 > b->info.bits64;
472+VAL idris_b64Eq(VM *vm, VAL a, VAL b) {
473+ VAL cl = allocate(vm, sizeof(Closure), 0);
475+ cl->info.bits64 = a->info.bits64 == b->info.bits64;
479+VAL idris_b64Lte(VM *vm, VAL a, VAL b) {
480+ VAL cl = allocate(vm, sizeof(Closure), 0);
482+ cl->info.bits64 = a->info.bits64 <= b->info.bits64;
486+VAL idris_b64Gte(VM *vm, VAL a, VAL b) {
487+ VAL cl = allocate(vm, sizeof(Closure), 0);
489+ cl->info.bits64 = a->info.bits64 >= b->info.bits64;
493+VAL idris_b64Compl(VM *vm, VAL a) {
494+ VAL cl = allocate(vm, sizeof(Closure), 0);
496+ cl->info.bits64 = ~ a->info.bits64;
500+VAL idris_b64And(VM *vm, VAL a, VAL b) {
501+ VAL cl = allocate(vm, sizeof(Closure), 0);
503+ cl->info.bits64 = a->info.bits64 & b->info.bits64;
507+VAL idris_b64Or(VM *vm, VAL a, VAL b) {
508+ VAL cl = allocate(vm, sizeof(Closure), 0);
510+ cl->info.bits64 = a->info.bits64 | b->info.bits64;
514+VAL idris_b64Xor(VM *vm, VAL a, VAL b) {
515+ VAL cl = allocate(vm, sizeof(Closure), 0);
517+ cl->info.bits64 = a->info.bits64 ^ b->info.bits64;
521+VAL idris_b64Shl(VM *vm, VAL a, VAL b) {
522+ VAL cl = allocate(vm, sizeof(Closure), 0);
524+ cl->info.bits64 = a->info.bits64 << b->info.bits64;
528+VAL idris_b64LShr(VM *vm, VAL a, VAL b) {
529+ VAL cl = allocate(vm, sizeof(Closure), 0);
531+ cl->info.bits64 = a->info.bits64 >> b->info.bits64;
535+VAL idris_b64AShr(VM *vm, VAL a, VAL b) {
536+ VAL cl = allocate(vm, sizeof(Closure), 0);
538+ cl->info.bits64 = (uint64_t) (((int64_t)a->info.bits64) >> ((int64_t)b->info.bits64));
542+VAL idris_b8Z16(VM *vm, VAL a) {
543+ VAL cl = allocate(vm, sizeof(Closure), 0);
545+ cl->info.bits16 = (uint16_t) a->info.bits8;
549+VAL idris_b8Z32(VM *vm, VAL a) {
550+ VAL cl = allocate(vm, sizeof(Closure), 0);
552+ cl->info.bits32 = (uint32_t) a->info.bits8;
556+VAL idris_b8Z64(VM *vm, VAL a) {
557+ VAL cl = allocate(vm, sizeof(Closure), 0);
559+ cl->info.bits64 = (uint64_t) a->info.bits8;
563+VAL idris_b8S16(VM *vm, VAL a) {
564+ VAL cl = allocate(vm, sizeof(Closure), 0);
566+ cl->info.bits16 = (uint16_t) (int16_t) (int8_t) a->info.bits8;
570+VAL idris_b8S32(VM *vm, VAL a) {
571+ VAL cl = allocate(vm, sizeof(Closure), 0);
573+ cl->info.bits32 = (uint32_t) (int32_t) (int8_t) a->info.bits8;
577+VAL idris_b8S64(VM *vm, VAL a) {
578+ VAL cl = allocate(vm, sizeof(Closure), 0);
580+ cl->info.bits64 = (uint64_t) (int64_t) (int8_t) a->info.bits8;
584+VAL idris_b16Z32(VM *vm, VAL a) {
585+ VAL cl = allocate(vm, sizeof(Closure), 0);
587+ cl->info.bits32 = (uint32_t) a->info.bits16;
591+VAL idris_b16Z64(VM *vm, VAL a) {
592+ VAL cl = allocate(vm, sizeof(Closure), 0);
594+ cl->info.bits64 = (uint64_t) a->info.bits16;
598+VAL idris_b16S32(VM *vm, VAL a) {
599+ VAL cl = allocate(vm, sizeof(Closure), 0);
601+ cl->info.bits32 = (uint32_t) (int32_t) (int16_t) a->info.bits16;
605+VAL idris_b16S64(VM *vm, VAL a) {
606+ VAL cl = allocate(vm, sizeof(Closure), 0);
608+ cl->info.bits64 = (uint64_t) (int64_t) (int16_t) a->info.bits16;
612+VAL idris_b16T8(VM *vm, VAL a) {
613+ VAL cl = allocate(vm, sizeof(Closure), 0);
615+ cl->info.bits8 = (uint8_t) a->info.bits16;
619+VAL idris_b32Z64(VM *vm, VAL a) {
620+ VAL cl = allocate(vm, sizeof(Closure), 0);
622+ cl->info.bits64 = (uint64_t) a->info.bits32;
626+VAL idris_b32S64(VM *vm, VAL a) {
627+ VAL cl = allocate(vm, sizeof(Closure), 0);
629+ cl->info.bits64 = (uint64_t) (int64_t) (int32_t) a->info.bits32;
633+VAL idris_b32T8(VM *vm, VAL a) {
634+ VAL cl = allocate(vm, sizeof(Closure), 0);
636+ cl->info.bits8 = (uint8_t) a->info.bits32;
640+VAL idris_b32T16(VM *vm, VAL a) {
641+ VAL cl = allocate(vm, sizeof(Closure), 0);
643+ cl->info.bits16 = (uint16_t) a->info.bits32;
308 return cl;
644 return cl;