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 / seed / equiv / bitrev.unit.om

18 lines · 480 bytes Raw Blame History
1note irequiv fixture (issue 826): reverse the bits of a byte.
2note bitrev8 is copied verbatim from tests/one_layer/omegese/dev/dev09.omegese
3note (omega-mv 62d1d0d6). bitrev8s is a refactor: a three-stage swap network.
4fn bitrev8 x uchar to uchar
5r = uchar 0
6for i uint 8
7r = shl r 1
8b = and x 1
9r = or r b
10x = shr x 1
11end
12ret r
13end
14fn bitrev8s x uchar to uchar
15x = or shr and x 240 4 shl and x 15 4
16x = or shr and x 204 2 shl and x 51 2
17ret or shr and x 170 1 shl and x 85 1
18end