sovereign-intelligence
Front door to Drake Stapleton's sovereign stack.
Brought by drakestapleton
sovereign-intelligence / tools / adapter / half.om
| 1 | fn h2f h ushort to f32 |
| 2 | v = uint h |
| 3 | s = shl and shr v 15 1 31 |
| 4 | e = and shr v 10 31 |
| 5 | m = and v 1023 |
| 6 | if eq e 0 |
| 7 | z = mul f32 m 0.000000059604644775390625f32 |
| 8 | if eq s 0 |
| 9 | ret z |
| 10 | end |
| 11 | ret neg z |
| 12 | end |
| 13 | if eq e 31 |
| 14 | ret bitcast f32 or or s 2139095040 shl m 13 |
| 15 | end |
| 16 | ret bitcast f32 or or s shl add e 112 23 shl m 13 |
| 17 | end |