Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/omega-mv/blob/main/si/rosetta/tasks/binary-digits/binary-digits.om # 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 Sign in to star 1 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `omega-mv / si / rosetta / tasks / binary-digits / binary-digits.om` 38 lines ยท 665 bytes Raw Blame History 1 note Rosetta Code task "Binary digits": https://rosettacode.org/wiki/Binary_digits 2 note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 3 om2 4 text nl "\n" 5 note emit writes every byte of a to stdout; a short write is retried, an error exits 1 6 fn emit a view uchar * to void 7 o = ulong 0 8 while lt o len a bound 4096 9 k = write 1 a o sub len a o 10 if le k 0 11 exit 1 12 end 13 o = add o ulong k 14 end 15 end 16 fn bin n ulong to void 17 d = new uchar 64 0 18 i = ulong 64 19 v = n 20 while true bound 64 21 i = sub i 1 22 put d i uchar add and v 1 48 23 v = shr v 1 24 if eq v 0 25 break 26 end 27 end 28 emit part d i sub 64 i 29 emit nl 30 end 31 fn main to int 32 bin 0 33 bin 5 34 bin 50 35 bin 9000 36 bin `18446744073709551615` 37 ret 0 38 end