compiler/
lib/
scripts/
seed/
test/
tests/
abi.sizes.rad
3.4 KiB
addfn.rad
52 B
addfn.ril
76 B
aggregate.return.rad
4.1 KiB
arith.assignment.rad
595 B
arith.basic.rad
191 B
arith.modulo.rad
111 B
arith.subword.rad
3.9 KiB
arith.subword.ril
4.3 KiB
arith.sum.rad
192 B
arith.w64.rad
4.1 KiB
arith.w64.ril
5.2 KiB
array.aggregate.stride.rad
753 B
array.aggregate.stride.ril
1.1 KiB
array.assign.rad
221 B
array.assign.ril
526 B
array.bounds.check.rad
321 B
array.index.assign.rad
382 B
array.index.rad
264 B
array.index.ril
496 B
array.len.const.rad
348 B
array.len.const.ril
200 B
array.length.rad
277 B
array.literal.rad
136 B
array.literal.ril
329 B
array.math.rad
1.2 KiB
array.nested.assign.rad
319 B
array.nested.rad
325 B
array.nested.ril
922 B
array.record.elements.rad
1.7 KiB
array.repeat.edge.rad
548 B
array.repeat.rad
828 B
array.repeat.ril
3.0 KiB
array.return.rad
345 B
array.slice.empty.rad
123 B
array.slice.full.rad
110 B
array.slice.full.ril
168 B
array.slice.gen.end.rad
141 B
array.slice.gen.index.rad
154 B
array.slice.gen.open.rad
140 B
array.slice.gen.start.end.rad
142 B
array.slice.gen.start.rad
141 B
array.slice.openend.rad
134 B
array.slice.openend.ril
245 B
array.slice.openstart.rad
134 B
array.slice.openstart.ril
183 B
array.slice.rad
774 B
as.precedence.rad
226 B
assert.basic.rad
402 B
assert.basic.ril
624 B
assert.fail.rad
138 B
assert.false.rad
140 B
assert.message.rad
123 B
assert.message.ril
141 B
assert.true.rad
115 B
assign.loop.rad
205 B
assign.loop.ril
242 B
assign.multi.var.rad
182 B
assign.multi.var.ril
73 B
assign.mutable.rad
6.1 KiB
assign.param.rad
142 B
assign.param.ril
96 B
assign.rad
144 B
assign.self.ref.rad
153 B
assign.self.ref.ril
92 B
assign.sequential.rad
155 B
assign.sequential.ril
52 B
assign.shadow.mutable.rad
461 B
assign.use.intermediate.rad
187 B
assign.use.intermediate.ril
99 B
average.rad
185 B
average.ril
378 B
binop.arith.rad
479 B
binop.arith.ril
389 B
binop.bitwise.rad
1.2 KiB
binop.bitwise.ril
1.2 KiB
binop.cmp.rad
441 B
binop.logical.rad
216 B
binop.logical.ril
373 B
binop.shift.rad
197 B
binop.shift.ril
149 B
binop.unsigned.rad
317 B
binop.unsigned.ril
236 B
bool.comparison.array.rad
688 B
bool.comparison.nested.gen.rad
1.0 KiB
bool.comparison.opt.rad
905 B
bool.comparison.record.gen.rad
1.0 KiB
bool.comparison.record.rad
1.1 KiB
bool.comparison.slice.gen.rad
157 B
bool.comparison.slice.rad
4.1 KiB
bool.comparison.slice.record.gen.rad
2.0 KiB
bool.comparison.slice.union.gen.rad
2.5 KiB
bool.comparison.union.ctor.rad
705 B
bool.comparison.union.gen.rad
1.2 KiB
bool.comparison.union.record.gen.rad
1.5 KiB
bool.comparison.union.simple.gen.rad
296 B
bool.operators.complex.rad
384 B
bool.operators.rad
831 B
bool.short.circuit.rad
2.3 KiB
bool.simple.rad
209 B
bool.values.rad
787 B
builtin.alignof.rad
692 B
builtin.alignof.ril
287 B
builtin.size.align.rad
1.2 KiB
builtin.sizeof.rad
650 B
builtin.sizeof.ril
282 B
builtin.sliceof.mut.rad
621 B
builtin.sliceof.rad
505 B
byte.load.store.rad
372 B
byte.load.store.ril
730 B
call.arg.clobber.rad
732 B
call.basic.rad
256 B
call.clobber.rad
477 B
call.tests.rad
764 B
call.tests.ril
603 B
cast.basic.rad
848 B
cast.basic.ril
594 B
cast.narrow.rad
583 B
cast.narrow.ril
557 B
cast.same.size.rad
1.0 KiB
cast.same.size.ril
1.1 KiB
casting.numbers.rad
1.5 KiB
char.literal.rad
180 B
cmp.rel.rad
733 B
cmp.rel.ril
467 B
cmp.unsigned.rad
733 B
cmp.unsigned.ril
467 B
coercion.implicit.rad
917 B
coercion.implicit.ril
1.0 KiB
compound.assign.field.rad
300 B
compound.assign.rad
1.1 KiB
compound.assign.ril
2.0 KiB
cond.assign.merge.basic.rad
213 B
cond.assign.merge.basic.ril
172 B
cond.assign.merge.rad
206 B
cond.assign.merge.ril
169 B
cond.assign.rad
738 B
cond.elseif.rad
204 B
cond.elseif.ril
181 B
cond.expr.aggregate.rad
1.2 KiB
cond.expr.rad
1.9 KiB
cond.expr.ril
3.5 KiB
cond.for.else.break.rad
341 B
cond.for.indexed.rad
253 B
cond.for.rad
180 B
cond.for.range.indexed.rad
541 B
cond.for.range.rad
186 B
cond.for.unsigned.range.rad
659 B
cond.forever.break.continue.rad
197 B
cond.forever.break.rad
247 B
cond.fused.rad
941 B
cond.if.case.rad
2.2 KiB
cond.if.else.min.rad
158 B
cond.if.else.rad
240 B
cond.if.elseif.rad
435 B
cond.if.noelse.rad
135 B
cond.if.rad
880 B
cond.ifelse.rad
104 B
cond.ifelse.ril
117 B
cond.iflet.case.rad
170 B
cond.iflet.case.ril
114 B
cond.iflet.guard.rad
182 B
cond.iflet.guard.ril
165 B
cond.iflet.mut.rad
191 B
cond.iflet.mut.ril
217 B
cond.iflet.noelse.rad
156 B
cond.iflet.noelse.ril
225 B
cond.iflet.optional.rad
184 B
cond.iflet.optional.ril
118 B
cond.iflet.optional.value.rad
194 B
cond.iflet.optional.value.ril
206 B
cond.letelse.case.rad
146 B
cond.letelse.case.ril
118 B
cond.letelse.guard.rad
160 B
cond.letelse.guard.ril
169 B
cond.letelse.mut.rad
181 B
cond.letelse.mut.ril
221 B
cond.letelse.optional.rad
160 B
cond.letelse.optional.ril
122 B
cond.match.fallthrough.rad
384 B
cond.match.guard.rad
1.4 KiB
cond.match.guard.regalloc.rad
1.3 KiB
cond.nested.rad
138 B
cond.nested.ril
185 B
cond.simple.rad
86 B
cond.simple.ril
118 B
cond.while.else.break.rad
297 B
cond.while.rad
134 B
const-expr-array-size.rad
356 B
const-expr-cast.rad
1.0 KiB
const-expr-literal.rad
628 B
const-expr-refs.rad
716 B
const.array.copy.mutate.rad
386 B
const.array.ident.rad
238 B
const.array.ident.ril
146 B
const.array.rad
210 B
const.array.record.ident.rad
378 B
const.array.record.ident.ril
353 B
const.array.repeat.record.rad
216 B
const.array.repeat.record.ril
399 B
const.array.ril
392 B
const.array.strings.slice.rad
271 B
const.array.strings.slice.ril
539 B
const.basic.rad
340 B
const.char.rad
174 B
const.fn.array.rad
664 B
const.negative.rad
322 B
const.negative.ril
338 B
const.record.array.rad
1.2 KiB
const.record.array.simple.rad
538 B
const.record.ctor.rad
185 B
const.record.ctor.ril
415 B
const.record.fn.rad
353 B
const.record.mutcopy.rad
450 B
const.record.mutcopy.ril
385 B
const.record.nested.rad
393 B
const.record.nested.ril
474 B
const.record.packed.rad
266 B
const.record.packed.ril
284 B
const.record.padded.rad
266 B
const.record.padded.ril
318 B
const.record.rad
197 B
const.record.ril
221 B
const.record.union.rad
593 B
const.record.union.ril
625 B
const.scalar.rad
102 B
const.scalar.ril
82 B
const.slice.of.slices.rad
232 B
const.slice.of.slices.ril
876 B
const.slice.param.rad
333 B
const.string.rad
111 B
const.string.ril
285 B
const.string.scoped.names.rad
254 B
const.string.scoped.names.ril
840 B
const.union.payload.ctor.rad
364 B
const.union.payload.ctor.ril
507 B
const.union.record.literal.rad
374 B
const.union.record.literal.ril
506 B
data.array.rad
782 B
data.bool.rad
231 B
data.i16.rad
276 B
data.i32.rad
296 B
data.i8.rad
263 B
data.record.rad
576 B
data.simple.rad
451 B
data.u16.rad
235 B
data.u32.rad
255 B
data.u8.rad
223 B
data.union.rad
901 B
debug.tag.rad
557 B
ecall.i64.rad
497 B
edge.cases.2.rad
352 B
edge.cases.3.rad
594 B
edge.cases.4.rad
1.2 KiB
edge.cases.5.rad
1.1 KiB
edge.cases.6.rad
2.6 KiB
edge.cases.7.addr.bug.rad
224 B
edge.cases.8.bug.rad
523 B
edge.cases.rad
238 B
error.basic.rad
174 B
error.catch.rad
1.6 KiB
error.catch.return.rad
403 B
error.catch.return.ril
634 B
error.division.zero.rad
164 B
error.modulo.zero.rad
162 B
error.multi.basic.rad
687 B
error.multi.catch.rad
787 B
error.multi.catch.typed.binding.rad
806 B
error.multi.catch.typed.catchall.rad
1.0 KiB
error.multi.catch.typed.rad
1.1 KiB
error.multi.propagate.multi.rad
968 B
error.multi.propagate.rad
840 B
error.multi.try.optional.rad
522 B
error.slice.bounds.rad
219 B
error.try.bang.success.rad
370 B
error.try.catch.binding.rad
2.0 KiB
error.try.optional.rad
1.9 KiB
error.try.rad
4.0 KiB
externfn.rad
39 B
externfn.ril
37 B
fibonacci.rad
122 B
fibonacci.ril
247 B
field.aggregate.rad
793 B
field.aggregate.ril
782 B
fn.block.scope.rad
508 B
fn.callback.nested.rad
1.2 KiB
fn.default.rad
146 B
fn.local.rad
155 B
fn.ptr.assign.rad
277 B
fn.ptr.assign.ril
143 B
fn.ptr.call.rad
258 B
fn.ptr.call.ril
183 B
fn.ptr.param.rad
356 B
fn.ptr.param.ril
282 B
fn.recursion.2.rad
239 B
fn.void.rad
165 B
for.else.continue.rad
1.1 KiB
frame.large.rad
582 B
if-let-mut.rad
1.2 KiB
iflet.shadow.leak.rad
317 B
index.u8.rad
594 B
int.default.i64.rad
1.1 KiB
integer.bitwise.basic.rad
708 B
integer.overflow.rad
1.8 KiB
intrinsic.ebreak.rad
97 B
intrinsic.ebreak.ril
76 B
intrinsic.ecall.rad
175 B
intrinsic.ecall.ril
131 B
large.blit.store.rad
2.1 KiB
let.copy.semantics.rad
871 B
let.copy.semantics.ril
879 B
let.guard.rad
1.9 KiB
let.placeholder.rad
291 B
let.placeholder.ril
220 B
literal.char.rad
209 B
literal.char.ril
127 B
literal.slice.bytes.rad
124 B
literal.slice.bytes.ril
245 B
literal.slice.dedup.rad
199 B
literal.slice.dedup.ril
407 B
literal.slice.empty.rad
100 B
literal.slice.empty.ril
157 B
literal.slice.multi.rad
170 B
literal.slice.multi.ril
460 B
literal.slice.rad
123 B
literal.slice.record.rad
211 B
literal.slice.record.ril
676 B
literal.slice.ril
254 B
literal.string.dedup.rad
179 B
literal.string.dedup.ril
395 B
literal.string.empty.rad
93 B
literal.string.empty.ril
230 B
literal.string.fns.rad
180 B
literal.string.fns.ril
434 B
literal.string.multi.rad
153 B
literal.string.multi.ril
444 B
literal.string.rad
108 B
literal.string.ril
229 B
literal.w64.rad
1.7 KiB
load.u32.high.rad
1.8 KiB
loc.addr.offset.bug.rad
425 B
loc.addr.opt.to.opt.rad
448 B
loc.addr.optional.assign.rad
423 B
loc.addr.record.assign.rad
458 B
local.multi.rad
85 B
local.multi.ril
67 B
local.mut.rad
75 B
local.mut.ril
45 B
local.simple.rad
60 B
local.simple.ril
45 B
loop.break.rad
152 B
loop.break.ril
228 B
loop.complex.flow.rad
1022 B
loop.continue.rad
211 B
loop.continue.ril
327 B
loop.for.array.rad
219 B
loop.for.array.ril
315 B
loop.for.break.bound.rad
161 B
loop.for.break.bound.ril
264 B
loop.for.continue.rad
395 B
loop.for.continue.ril
741 B
loop.for.indexed.rad
145 B
loop.for.indexed.ril
285 B
loop.for.placeholder.rad
313 B
loop.for.placeholder.ril
457 B
loop.for.rad
116 B
loop.for.ril
220 B
loop.for.slice.rad
212 B
loop.for.slice.ril
362 B
loop.for.unsigned.range.rad
309 B
loop.for.unsigned.range.ril
481 B
loop.infinite.rad
41 B
loop.infinite.ril
78 B
loop.mutable.rad
371 B
loop.mutable.ril
617 B
loop.nested.break.rad
380 B
loop.nested.break.ril
461 B
loop.nested.continue.rad
406 B
loop.nested.continue.ril
581 B
loop.return.rad
137 B
loop.return.ril
179 B
loop.sealblock.rad
926 B
loop.while.false.noparams.rad
175 B
loop.while.false.noparams.ril
171 B
loop.while.nested.shortcircuit.rad
860 B
loop.while.nested.shortcircuit.ril
589 B
loop.while.rad
156 B
loop.while.ril
241 B
loop.whilelet.case.rad
251 B
loop.whilelet.case.ril
204 B
loop.whilelet.guard.rad
257 B
loop.whilelet.guard.ril
256 B
loop.whilelet.optional.rad
208 B
loop.whilelet.optional.ril
217 B
loop.whilelet.union.rad
368 B
loop.whilelet.union.ril
382 B
match.array.rad
3.5 KiB
match.char.rad
1.6 KiB
match.more.rad
643 B
match.more.ril
683 B
match.multi.seal.rad
1002 B
match.multi.seal.ril
924 B
match.multi.survive.rad
1.6 KiB
match.mutref.push.rad
1.0 KiB
match.mutref.union.rad
677 B
match.nested.call.rad
1.7 KiB
match.nested.deep.rad
2.2 KiB
match.nested.deref.rad
3.7 KiB
match.nested.guard.rad
1.6 KiB
match.nested.iflet.guard.rad
1.6 KiB
match.nested.iflet.rad
1.4 KiB
match.nested.iflet.ril
2.3 KiB
match.nested.letelse.rad
828 B
match.nested.letelse.union.rad
1.3 KiB
match.nested.literal.rad
3.1 KiB
match.nested.multi.rad
2.4 KiB
match.nested.pattern.rad
5.2 KiB
match.nested.pattern.ril
8.3 KiB
match.nested.record.rad
2.1 KiB
match.nested.record.ril
3.5 KiB
match.nested.union.rad
2.3 KiB
match.nested.union.ril
4.5 KiB
match.nested.whilelet.rad
2.4 KiB
match.optional.aggregate.rad
222 B
match.optional.aggregate.ril
578 B
match.optional.rad
183 B
match.optional.ril
164 B
match.record.pattern.rad
325 B
match.record.pattern.ril
287 B
match.simple.rad
367 B
match.simple.ril
347 B
match.string.rad
1.8 KiB
match.switch.rad
217 B
match.switch.ril
187 B
match.value.copy.rad
2.0 KiB
match.void.then.or.rad
1.6 KiB
memzero.result.bug.rad
821 B
memzero.union.bug.rad
591 B
method.basic.rad
554 B
method.chain.rad
560 B
method.multiple.rad
888 B
method.ptr.rad
662 B
method.pub.rad
238 B
method.return.rad
599 B
method.throws.rad
829 B
method.union.rad
424 B
method.with.trait.rad
644 B
mixedtypes.rad
79 B
mixedtypes.ril
82 B
multi.throw.basic.rad
272 B
multi.throw.basic.ril
526 B
multi.throw.catch.typed.rad
436 B
multi.throw.catch.typed.ril
1015 B
multi.throw.propagate.rad
335 B
multi.throw.propagate.ril
873 B
multiplefns.rad
110 B
multiplefns.ril
146 B
mutref.loop.bug.rad
1.8 KiB
mutref.loop.rad
281 B
mutref.loop.ril
368 B
mutref.scalar.rad
228 B
mutref.scalar.ril
324 B
nil.cmp.rad
622 B
nil.cmp.ril
423 B
noparams.rad
38 B
noparams.ril
43 B
opt.array.hint.rad
951 B
opt.assignment.bug.rad
1.3 KiB
opt.bug.test.rad
1.4 KiB
opt.if.let.complex.rad
6.2 KiB
opt.if.let.guard.rad
809 B
opt.if.let.rad
956 B
opt.nil.check.rad
1.5 KiB
opt.ptr.return.nil.rad
85 B
opt.ptr.return.nil.ril
51 B
opt.record.eq.rad
842 B
opt.record.eq.rev.rad
307 B
opt.record.eq.rev.ril
635 B
opt.record.eq.ril
3.4 KiB
opt.record.rad
655 B
opt.return.array.rad
289 B
opt.return.nested.rad
797 B
opt.return.nil.rad
82 B
opt.return.nil.ril
114 B
opt.return.record.rad
344 B
opt.return.value.rad
91 B
opt.return.value.ril
138 B
opt.slice.npo.rad
2.8 KiB
opt.slice.npo.ril
6.8 KiB
opt.type.rad
215 B
opt.while.let.complex.rad
404 B
optional.aggregate.eq.rad
286 B
optional.aggregate.eq.ril
695 B
optional.eq.rad
131 B
optional.eq.ril
253 B
optional.ptr.eq.rad
313 B
optional.ptr.eq.ril
309 B
panic.basic.rad
70 B
panic.basic.ril
46 B
panic.rad
111 B
placeholder.basic.rad
148 B
placeholder.comprehensive.rad
577 B
pointer.copy.edge.case.rad
1.3 KiB
pointer.slice.index.rad
284 B
pointer.slice.store.rad
896 B
pointerfn.rad
50 B
pointerfn.ril
54 B
prog.ackermann.rad
5.0 KiB
prog.bignum.rad
9.5 KiB
prog.binsearch.rad
2.5 KiB
prog.bubblesort.rad
2.0 KiB
prog.cordic.rad
6.9 KiB
prog.crc32.rad
2.7 KiB
prog.dijkstra.rad
7.7 KiB
prog.eval.rad
6.2 KiB
prog.hanoi.rad
3.8 KiB
prog.huffman.rad
9.3 KiB
prog.hybridsort.rad
3.1 KiB
prog.linkedlist.rad
5.9 KiB
prog.lzw.rad
6.7 KiB
prog.matmul.rad
2.9 KiB
prog.mersenne.rad
5.2 KiB
prog.nqueens.rad
3.4 KiB
prog.rbtree.rad
8.3 KiB
prog.regex.rad
10.2 KiB
prog.sha256.rad
7.1 KiB
prog.sieve.rad
2.8 KiB
prog.symtab.rad
10.1 KiB
prog.tokenizer.rad
13.9 KiB
prog.vm.rad
17.4 KiB
ptr.addressof.field.rad
132 B
ptr.addressof.field.ril
78 B
ptr.addressof.local.rad
455 B
ptr.addressof.local.ril
280 B
ptr.addressof.rad
119 B
ptr.addressof.ril
213 B
ptr.assign.rad
137 B
ptr.assign.ril
130 B
ptr.deref.rad
622 B
ptr.deref.record.rad
282 B
ptr.deref.record.ril
190 B
ptr.deref.ril
1.1 KiB
ptr.eq.rad
981 B
ptr.mutate.rad
244 B
ptr.opaque.rad
1.4 KiB
ptr.subscript.assign.rad
129 B
ptr.subscript.assign.ril
288 B
range.arithmetic.rad
723 B
record.access.rad
300 B
record.alignment.rad
194 B
record.array.elements.rad
1.7 KiB
record.assign.blit.rad
111 B
record.assign.blit.ril
158 B
record.copy.rad
2.0 KiB
record.ctor.tuple.rad
69 B
record.ctor.tuple.ril
127 B
record.empty.eq.rad
272 B
record.empty.eq.ril
226 B
record.eq.rad
223 B
record.eq.ril
214 B
record.field.assign.rad
199 B
record.field.assign.ril
308 B
record.literal.labeled.rad
103 B
record.literal.labeled.ril
127 B
record.mixed.layout.rad
116 B
record.mixed.layout.ril
149 B
record.nested.calls.2.rad
612 B
record.nested.calls.3.rad
749 B
record.nested.eq.rad
246 B
record.nested.eq.ril
522 B
record.nested.lit.rad
170 B
record.nested.lit.ril
188 B
record.param.lit.rad
368 B
record.ptr.access.rad
242 B
record.ptr.access.ril
198 B
record.ptr.mutate.rad
235 B
record.shorthand.rad
1.5 KiB
record.unlabeled.deref.rad
1.4 KiB
record.unlabeled.rad
407 B
ref.if.bug.rad
519 B
ref.immut.loop.bug.rad
670 B
ref.mut.ptr.rad
253 B
regalloc.callee.save.rad
1.5 KiB
regalloc.spill.reuse.rad
488 B
reserve.loop.rad
407 B
reserve.loop.ril
473 B
result.void.success.rad
701 B
return.lit.rad
45 B
return.lit.ril
50 B
return.param.rad
48 B
return.param.ril
54 B
simplefn.rad
45 B
simplefn.ril
51 B
slice.alloc.loop.rad
803 B
slice.append.rad
4.1 KiB
slice.append.ril
18.4 KiB
slice.assign.mismatch.rad
216 B
slice.assign.rad
1.4 KiB
slice.basic.rad
742 B
slice.basic.ril
711 B
slice.cap.rad
956 B
slice.delete.rad
986 B
slice.delete.ril
4.8 KiB
slice.eq.rad
126 B
slice.eq.ril
209 B
slice.index.rad
104 B
slice.index.ril
278 B
slice.mutable.rad
281 B
slice.mutable.ril
1.7 KiB
slice.of.rad
475 B
slice.range.rad
606 B
slice.range.ril
1.2 KiB
slice.runtime.i32.rad
237 B
slice.runtime.i32.ril
725 B
slice.runtime.literal.rad
240 B
slice.runtime.literal.ril
455 B
slice.subslice.rad
1.4 KiB
spill.blockarg.clobber.rad
3.5 KiB
spill.loop.rad
1.6 KiB
stack.local.corrupt.rad
335 B
static.array.mutate.rad
402 B
static.assign.rad
127 B
static.assign.ril
244 B
static.basic.rad
327 B
static.fn.array.rad
628 B
static.local.decl.rad
191 B
static.local.decl.ril
280 B
static.record.array.rad
518 B
static.scalar.rad
109 B
static.scalar.ril
135 B
static.slice.index.assign.rad
408 B
static.slice.offset.rad
683 B
string.basic.rad
164 B
string.escape.rad
364 B
string.index.rad
131 B
switch.blockargs.clobber.rad
1.4 KiB
trait.aggregate.ret.rad
1.5 KiB
trait.array.optional.rad
1.7 KiB
trait.basic.rad
580 B
trait.control.flow.rad
1.2 KiB
trait.dispatch.rad
323 B
trait.dispatch.ril
469 B
trait.fn.param.rad
1.7 KiB
trait.multiple.methods.rad
1.2 KiB
trait.multiple.traits.rad
1.2 KiB
trait.multiple.types.rad
1.3 KiB
trait.object.rad
356 B
trait.object.ril
496 B
trait.supertrait.rad
2.6 KiB
trait.supertrait.ril
3.8 KiB
trait.throws.rad
1.0 KiB
trait.writer.rad
2.6 KiB
trivial.phi.rad
1.1 KiB
trivial.phi.ril
512 B
try.basic.rad
391 B
try.basic.ril
879 B
try.catch.rad
339 B
try.catch.ril
837 B
try.optional.rad
363 B
try.optional.ril
760 B
try.panic.rad
351 B
try.panic.ril
639 B
type.unify.rad
4.5 KiB
undefined.aggregate.rad
152 B
undefined.aggregate.ril
84 B
undefined.primitive.rad
115 B
undefined.primitive.ril
48 B
undefined.rad
432 B
undefined.record.field.rad
1.6 KiB
undefined.record.field.ril
751 B
union-tag.rad
926 B
union.bitfield.rad
1.2 KiB
union.ctor.rad
552 B
union.ctor.ril
385 B
union.discriminant.cast.rad
389 B
union.edge.case.2.rad
694 B
union.edge.case.3.rad
623 B
union.eq.rad
783 B
union.eq.ril
1.4 KiB
union.eq.void.ctor.rad
378 B
union.eq.void.ctor.ril
131 B
union.eq.void.rad
178 B
union.eq.void.ril
75 B
union.match.bind.rad
259 B
union.match.bind.ril
238 B
union.match.ref.rad
1.1 KiB
union.match.ref.ril
1.2 KiB
union.match.tag.rad
858 B
union.match.tag.ril
820 B
union.mixed.assign.rad
992 B
union.payload.mutref.rad
1.4 KiB
union.payload.rad
595 B
union.payload.record.eq.rad
292 B
union.payload.record.eq.ril
984 B
union.record.forward.rad
1.3 KiB
union.record.literal.rad
444 B
union.record.literal.ril
391 B
union.variant.access.rad
731 B
union.variant.access.ril
506 B
union.void.match.rad
418 B
union.void.rad
839 B
unop.rad
478 B
unop.ril
376 B
unsigned.compare.rad
1.9 KiB
var.align.rad
1.0 KiB
var.infer.rad
564 B
var.shadow.rad
236 B
var.shadow.ril
145 B
void.throw.rad
270 B
void.throw.ril
707 B
voidfn.rad
18 B
voidfn.ril
43 B
run
1.9 KiB
runner.rad
7.0 KiB
vim/
.gitignore
353 B
.gitsigners
112 B
LICENSE
1.1 KiB
Makefile
3.0 KiB
README
2.5 KiB
std.lib
1.0 KiB
std.lib.test
252 B
test/tests/prog.sha256.rad
raw
| 1 | //! returns: 0 |
| 2 | //! SHA-256 (single block). |
| 3 | //! Implement the SHA-256 compression function for a single 512-bit block. |
| 4 | //! Verify against a known hash of a short message. |
| 5 | |
| 6 | /// SHA-256 mutable state: hash values and message schedule. |
| 7 | record Sha256 { |
| 8 | h: [u32; 8], |
| 9 | w: [u32; 64], |
| 10 | } |
| 11 | |
| 12 | /// SHA-256 initial hash values (first 32 bits of fractional parts of square |
| 13 | /// roots of the first 8 primes). |
| 14 | const INIT_H: [u32; 8] = [ |
| 15 | 0x6A09E667, 0xBB67AE85, 0x3C6EF372, 0xA54FF53A, |
| 16 | 0x510E527F, 0x9B05688C, 0x1F83D9AB, 0x5BE0CD19 |
| 17 | ]; |
| 18 | |
| 19 | /// Right-rotate a 32-bit value by `n` bits. |
| 20 | fn rotr(x: u32, n: u32) -> u32 { |
| 21 | return (x >> n) | (x << (32 - n)); |
| 22 | } |
| 23 | |
| 24 | /// SHA-256 Ch function: Ch(e, f, g) = (e AND f) XOR (NOT e AND g). |
| 25 | fn ch(e: u32, f: u32, g: u32) -> u32 { |
| 26 | return (e & f) ^ (~e & g); |
| 27 | } |
| 28 | |
| 29 | /// SHA-256 Maj function: Maj(a, b, c) = (a AND b) XOR (a AND c) XOR (b AND c). |
| 30 | fn maj(a: u32, b: u32, c: u32) -> u32 { |
| 31 | return (a & b) ^ (a & c) ^ (b & c); |
| 32 | } |
| 33 | |
| 34 | /// SHA-256 big sigma 0: rotr(a, 2) XOR rotr(a, 13) XOR rotr(a, 22). |
| 35 | fn bsig0(a: u32) -> u32 { |
| 36 | return rotr(a, 2) ^ rotr(a, 13) ^ rotr(a, 22); |
| 37 | } |
| 38 | |
| 39 | /// SHA-256 big sigma 1: rotr(e, 6) XOR rotr(e, 11) XOR rotr(e, 25). |
| 40 | fn bsig1(e: u32) -> u32 { |
| 41 | return rotr(e, 6) ^ rotr(e, 11) ^ rotr(e, 25); |
| 42 | } |
| 43 | |
| 44 | /// SHA-256 small sigma 0: rotr(x, 7) XOR rotr(x, 18) XOR (x >> 3). |
| 45 | fn ssig0(x: u32) -> u32 { |
| 46 | return rotr(x, 7) ^ rotr(x, 18) ^ (x >> 3); |
| 47 | } |
| 48 | |
| 49 | /// SHA-256 small sigma 1: rotr(x, 17) XOR rotr(x, 19) XOR (x >> 10). |
| 50 | fn ssig1(x: u32) -> u32 { |
| 51 | return rotr(x, 17) ^ rotr(x, 19) ^ (x >> 10); |
| 52 | } |
| 53 | |
| 54 | /// Prepare the message schedule from a 16-word (512-bit) block. |
| 55 | fn prepareSchedule(s: *mut Sha256, block: *[u32]) { |
| 56 | // Copy the first 16 words directly. |
| 57 | let mut i: u32 = 0; |
| 58 | while i < 16 { |
| 59 | s.w[i] = block[i]; |
| 60 | i += 1; |
| 61 | } |
| 62 | // Extend to 64 words. |
| 63 | while i < 64 { |
| 64 | s.w[i] = ssig1(s.w[i - 2]) + s.w[i - 7] + ssig0(s.w[i - 15]) + s.w[i - 16]; |
| 65 | i += 1; |
| 66 | } |
| 67 | } |
| 68 | |
| 69 | /// Run the 64-round compression function. |
| 70 | fn compress(s: *mut Sha256, k: *[u32]) { |
| 71 | let mut a: u32 = s.h[0]; |
| 72 | let mut b: u32 = s.h[1]; |
| 73 | let mut c: u32 = s.h[2]; |
| 74 | let mut d: u32 = s.h[3]; |
| 75 | let mut e: u32 = s.h[4]; |
| 76 | let mut f: u32 = s.h[5]; |
| 77 | let mut g: u32 = s.h[6]; |
| 78 | let mut hh: u32 = s.h[7]; |
| 79 | |
| 80 | let mut i: u32 = 0; |
| 81 | while i < 64 { |
| 82 | let t1 = hh + bsig1(e) + ch(e, f, g) + k[i] + s.w[i]; |
| 83 | let t2 = bsig0(a) + maj(a, b, c); |
| 84 | hh = g; |
| 85 | g = f; |
| 86 | f = e; |
| 87 | e = d + t1; |
| 88 | d = c; |
| 89 | c = b; |
| 90 | b = a; |
| 91 | a = t1 + t2; |
| 92 | i += 1; |
| 93 | } |
| 94 | |
| 95 | s.h[0] += a; |
| 96 | s.h[1] += b; |
| 97 | s.h[2] += c; |
| 98 | s.h[3] += d; |
| 99 | s.h[4] += e; |
| 100 | s.h[5] += f; |
| 101 | s.h[6] += g; |
| 102 | s.h[7] += hh; |
| 103 | } |
| 104 | |
| 105 | /// Reset hash state to initial values. |
| 106 | fn resetHash(s: *mut Sha256) { |
| 107 | let mut i: u32 = 0; |
| 108 | while i < 8 { |
| 109 | s.h[i] = INIT_H[i]; |
| 110 | i += 1; |
| 111 | } |
| 112 | } |
| 113 | |
| 114 | /// Pad and hash a short message (up to 55 bytes, fits in one 512-bit block). |
| 115 | fn hashMessage(s: *mut Sha256, k: *[u32], msg: *[u8]) -> i32 { |
| 116 | // The message must fit in a single block (max 55 bytes for 1-block padding). |
| 117 | if msg.len > 55 { |
| 118 | return -1; |
| 119 | } |
| 120 | |
| 121 | // Build the 64-byte (512-bit) padded block. |
| 122 | let mut blockBytes: [u8; 64] = [0; 64]; |
| 123 | |
| 124 | // Copy message. |
| 125 | let mut i: u32 = 0; |
| 126 | while i < msg.len { |
| 127 | blockBytes[i] = msg[i]; |
| 128 | i += 1; |
| 129 | } |
| 130 | |
| 131 | // Append the 1-bit (0x80). |
| 132 | blockBytes[msg.len] = 0x80; |
| 133 | |
| 134 | // Append length in bits as big-endian 64-bit integer at the end. |
| 135 | let bitLen: u32 = msg.len * 8; |
| 136 | blockBytes[60] = (bitLen >> 24) as u8; |
| 137 | blockBytes[61] = (bitLen >> 16) as u8; |
| 138 | blockBytes[62] = (bitLen >> 8) as u8; |
| 139 | blockBytes[63] = bitLen as u8; |
| 140 | |
| 141 | // Convert bytes to 16 big-endian 32-bit words. |
| 142 | let mut block: [u32; 16] = [0; 16]; |
| 143 | let mut w: u32 = 0; |
| 144 | while w < 16 { |
| 145 | let base = w * 4; |
| 146 | block[w] = (blockBytes[base] as u32 << 24) |
| 147 | | (blockBytes[base + 1] as u32 << 16) |
| 148 | | (blockBytes[base + 2] as u32 << 8) |
| 149 | | (blockBytes[base + 3] as u32); |
| 150 | w += 1; |
| 151 | } |
| 152 | |
| 153 | resetHash(s); |
| 154 | prepareSchedule(s, &block[..]); |
| 155 | compress(s, k); |
| 156 | |
| 157 | return 0; |
| 158 | } |
| 159 | |
| 160 | /// Test SHA-256 of the empty string "". |
| 161 | /// Expected: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 |
| 162 | fn testEmpty(s: *mut Sha256, k: *[u32]) -> i32 { |
| 163 | assert hashMessage(s, k, &[]) == 0; |
| 164 | |
| 165 | assert s.h[0] == 0xE3B0C442; |
| 166 | assert s.h[1] == 0x98FC1C14; |
| 167 | assert s.h[2] == 0x9AFBF4C8; |
| 168 | assert s.h[3] == 0x996FB924; |
| 169 | assert s.h[4] == 0x27AE41E4; |
| 170 | assert s.h[5] == 0x649B934C; |
| 171 | assert s.h[6] == 0xA495991B; |
| 172 | assert s.h[7] == 0x7852B855; |
| 173 | return 0; |
| 174 | } |
| 175 | |
| 176 | /// Test SHA-256 of "abc". |
| 177 | /// Expected: ba7816bf 8f01cfea 414140de 5dae2223 b00361a3 96177a9c b410ff61 f20015ad |
| 178 | fn testAbc(s: *mut Sha256, k: *[u32]) -> i32 { |
| 179 | let msg: [u8; 3] = [0x61, 0x62, 0x63]; |
| 180 | assert hashMessage(s, k, &msg[..]) == 0; |
| 181 | |
| 182 | assert s.h[0] == 0xBA7816BF; |
| 183 | assert s.h[1] == 0x8F01CFEA; |
| 184 | assert s.h[2] == 0x414140DE; |
| 185 | assert s.h[3] == 0x5DAE2223; |
| 186 | assert s.h[4] == 0xB00361A3; |
| 187 | assert s.h[5] == 0x96177A9C; |
| 188 | assert s.h[6] == 0xB410FF61; |
| 189 | assert s.h[7] == 0xF20015AD; |
| 190 | return 0; |
| 191 | } |
| 192 | |
| 193 | /// Test the helper functions directly. |
| 194 | fn testHelpers() -> i32 { |
| 195 | // rotr(1, 1) should be 0x80000000 |
| 196 | assert rotr(1, 1) == 0x80000000; |
| 197 | // rotr(0xFF000000, 8) should be 0x00FF0000 |
| 198 | assert rotr(0xFF000000, 8) == 0x00FF0000; |
| 199 | // ch(0xFF, 0x0F, 0xF0): |
| 200 | // 0xFF & 0x0F = 0x0F |
| 201 | // ~0xFF = 0xFFFFFF00, & 0xF0 = 0x00 |
| 202 | // result = 0x0F ^ 0x00 = 0x0F |
| 203 | assert ch(0xFF, 0x0F, 0xF0) == 0x0F; |
| 204 | // maj(0xFF, 0x0F, 0xF0): |
| 205 | // 0xFF & 0x0F = 0x0F |
| 206 | // 0xFF & 0xF0 = 0xF0 |
| 207 | // 0x0F & 0xF0 = 0x00 |
| 208 | // result = 0x0F ^ 0xF0 ^ 0x00 = 0xFF |
| 209 | assert maj(0xFF, 0x0F, 0xF0) == 0xFF; |
| 210 | return 0; |
| 211 | } |
| 212 | |
| 213 | @default fn main() -> i32 { |
| 214 | // SHA-256 round constants (first 32 bits of fractional parts of cube roots |
| 215 | // of the first 64 primes). |
| 216 | let k: [u32; 64] = [ |
| 217 | 0x428A2F98, 0x71374491, 0xB5C0FBCF, 0xE9B5DBA5, |
| 218 | 0x3956C25B, 0x59F111F1, 0x923F82A4, 0xAB1C5ED5, |
| 219 | 0xD807AA98, 0x12835B01, 0x243185BE, 0x550C7DC3, |
| 220 | 0x72BE5D74, 0x80DEB1FE, 0x9BDC06A7, 0xC19BF174, |
| 221 | 0xE49B69C1, 0xEFBE4786, 0x0FC19DC6, 0x240CA1CC, |
| 222 | 0x2DE92C6F, 0x4A7484AA, 0x5CB0A9DC, 0x76F988DA, |
| 223 | 0x983E5152, 0xA831C66D, 0xB00327C8, 0xBF597FC7, |
| 224 | 0xC6E00BF3, 0xD5A79147, 0x06CA6351, 0x14292967, |
| 225 | 0x27B70A85, 0x2E1B2138, 0x4D2C6DFC, 0x53380D13, |
| 226 | 0x650A7354, 0x766A0ABB, 0x81C2C92E, 0x92722C85, |
| 227 | 0xA2BFE8A1, 0xA81A664B, 0xC24B8B70, 0xC76C51A3, |
| 228 | 0xD192E819, 0xD6990624, 0xF40E3585, 0x106AA070, |
| 229 | 0x19A4C116, 0x1E376C08, 0x2748774C, 0x34B0BCB5, |
| 230 | 0x391C0CB3, 0x4ED8AA4A, 0x5B9CCA4F, 0x682E6FF3, |
| 231 | 0x748F82EE, 0x78A5636F, 0x84C87814, 0x8CC70208, |
| 232 | 0x90BEFFFA, 0xA4506CEB, 0xBEF9A3F7, 0xC67178F2 |
| 233 | ]; |
| 234 | |
| 235 | let mut s: Sha256 = Sha256 { h: INIT_H, w: [0; 64] }; |
| 236 | |
| 237 | let r1 = testHelpers(); |
| 238 | if r1 != 0 { |
| 239 | return 10 + r1; |
| 240 | } |
| 241 | |
| 242 | let r2 = testEmpty(&mut s, &k[..]); |
| 243 | if r2 != 0 { |
| 244 | return 20 + r2; |
| 245 | } |
| 246 | |
| 247 | let r3 = testAbc(&mut s, &k[..]); |
| 248 | if r3 != 0 { |
| 249 | return 30 + r3; |
| 250 | } |
| 251 | return 0; |
| 252 | } |