elysium/example/test.ely
2024-10-31 20:50:09 +01:00

41 lines
457 B
Plaintext

u32 c(u32 n) {
u32 sum = 0u32;
while(n > 0u32) {
sum += n;
n -= 1u32;
}
return sum;
}
u64 fib(u64 i) {
u64 fibA = 0u64;
u64 fibB = 1u64;
while(--i > 0u64) {
u64 tmp = fibB;
fibB = fibA + fibB;
fibA = tmp;
}
return fibA;
}
(u64, u64) add(u64 a) {
u64 x = a++;
return x, a;
}
(u64, u64) tuple() {
return 1u64, 2u64;
}
u64 sub(u64 a) {
return --raw(u64, 0xFFu64);
}
u64 assign(u64 a) {
a += 1u64;
return raw(u64, a) += 2u64;
}