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 / lookup.om

40 lines · 769 bytes Raw Blame History
1note SPDX-License-Identifier: AGPL-3.0-only
2note Little-endian f32 decode table. First 256 E4M3FN encodings, then 16 E2M1 encodings.
3om2
4fn e4m3 c uint to uint
5e = and shr c 3 15
6m = and c 7
7raw = or shl add e 120 23 shl m 20
8if eq e 0
9raw = bitcast uint mul f32 m 0.001953125f32
10end
11if and eq e 15 eq m 7
12raw = uint 0x7fc00000
13end
14ret or raw shl and c 128 24
15end
16fn e2m1 c uint to uint
17e = and shr c 1 3
18m = and c 1
19raw = or shl add e 126 23 shl m 22
20if eq e 0
21raw = bitcast uint mul f32 m 0.5f32
22end
23ret or raw shl and c 8 28
24end
25fn main to int
26buf = new uchar 1088 0
27for i ulong 272
28v = e4m3 uint i
29if ge i 256
30v = e2m1 uint sub i 256
31end
32for j ulong 4
33put buf add mul i 4 j uchar and shr v uint mul j 8 255
34end
35end
36if ne write 1 buf 0 1088 1088
37ret 1
38end
39ret 0
40end