From 938773d9cc062fd028f6560b1127a2ecd23f61c3 Mon Sep 17 00:00:00 2001 From: Zuhaitz Méndez Fernández de Aránguiz Date: Tue, 27 Jan 2026 01:22:42 +0000 Subject: Fixed constant hex/oct bug + Fixed some of the examples (work in progress) + added bootloader example (I will add some docs) --- std/slice.zc | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 std/slice.zc (limited to 'std') diff --git a/std/slice.zc b/std/slice.zc new file mode 100644 index 0000000..778c6ed --- /dev/null +++ b/std/slice.zc @@ -0,0 +1,27 @@ + +struct Slice { + data: T*; + len: usize; +} + +impl Slice { + fn length(self) -> usize { + return self.len; + } + + fn is_empty(self) -> bool { + return self.len == 0; + } + + fn get(self, idx: usize) -> Option { + if (idx >= self.len) { + return Option::None(); + } + return Option::Some(self.data[idx]); + } + + fn at(self, idx: usize) -> Option { + if idx >= self.len { return Option::None(); } + return Option::Some(self.data[idx]); + } +} -- cgit v1.2.3