elysium/example/array.ely

33 lines
525 B
Plaintext
Raw Permalink Normal View History

2024-10-31 20:50:09 +01:00
u64 array() {
if(__builtin_memory_size() == 0u64) {
__builtin_memory_grow(1u64);
}
2024-11-16 20:09:29 +01:00
raw(u32, 0x0u64) = 2u32;
2024-10-31 20:50:09 +01:00
raw(u64, 0x04u64) = 69u64;
u64[] array = raw(u64[], 0x0u64);
array[0] = 1u64;
array[1] = 2u64;
return array[0] + array[1];
}
void array2() {
u64[] array = raw(u64[], 0x0u64);
array[0] = 1u64;
}
2024-11-16 20:09:29 +01:00
void outOfBounds() {
u64[] array = raw(u64[], 0x0u64);
array[100] = 69u64;
}
2024-10-31 20:50:09 +01:00
u64[] arrayReturn() {
if(__builtin_memory_size() == 0u64) {
__builtin_memory_grow(1u64);
}
return raw(u64[], 0x0u64);
}