MathCompare.select: def of stelliferous@0.0.2.0 Import: import stelliferous@0.0.2.0/math_compare.bend as MathCompare Lines 90-97 of stelliferous@0.0.2.0/math_compare.bend: https://jend.leeeet.dev/read.txt?path=stelliferous@0.0.2.0/math_compare.bend&start_line=90&end_line=97 import Base import stelliferous@0.0.2.0/math_fp32.bend as FP32 # Selection only changes words; the chosen payload is never FP arithmetic. # selected is 0 or all ones, so selected + 1 is 1 or 0 modulo 2^32. # This masked integer product keeps the native selection in value lanes. def select(mask: F32,yes: F32,no: F32) -> F32: +magnitude = U32.and(F32.bits(mask),2147483647) +selected = (0 - U32.shrn((magnitude + 2147483647 : U32),31n) : U32) +no = F32.bits(no) FP32.from_bits((U32.and(F32.bits(yes),selected) + no * (selected + 1 : U32) : U32)) Uses (9): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=F32 https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=F32.bits https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32 https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32.add https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32.and https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32.mul https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32.shrn https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32.sub https://jend.leeeet.dev/definition.txt?path=stelliferous@0.0.2.0/math_fp32.bend&name=from_bits