interplane.Get Omega
Read in your language

omega-mv

Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance.

Brought by drakestapleton

branch main Branches Tags History

omega-mv / om / gpu / dsv41 / decoder / io.om

29 lines · 663 bytes Raw Blame History
1note SPDX-License-Identifier: AGPL-3.0-only
2fn diRead fd int buf edit uchar * pos ulong count ulong to bool
3 used = ulong 0
4 while lt used count
5 n = pread fd buf used sub count used long add pos used
6 if eq n -4
7 continue
8 end
9 if le n 0
10 ret false
11 end
12 used = add used ulong n
13 end
14 ret true
15end
16
17fn diPut record edit uchar * off ulong width ulong v ulong to void
18 for i ulong width
19 put record add off i uchar and shr v mul i 8 255
20 end
21end
22
23fn diGet record view uchar * off ulong width ulong to ulong
24 value = ulong 0
25 for i ulong width
26 value = or value shl ulong get record add off i mul i 8
27 end
28 ret value
29end