Jpeg.jpeg.progressive.first.symbol: def of gralha-jpeg-decode@0.1.0.1 Import: import gralha-jpeg-decode@0.1.0.1/jpeg.bend as Jpeg Lines 277-290 of gralha-jpeg-decode@0.1.0.1/jpeg.bend: https://jend.leeeet.dev/read.txt?path=gralha-jpeg-decode@0.1.0.1/jpeg.bend&start_line=277&end_line=290 import Base import gralha-text-scan@0.1.0.1/scan.bend as U import gralha-bytes@0.1.0.1/bytes.bend as Bin def jpeg.progressive.first.symbol(read: JPEGRead, +index: U32, +end: U32, +offset: U32, +low: U32, +coefficients: Bin.Bytes, +predictor: U32) -> JPEGRefined: JPEGRead{symbol, stream} = read +rs = symbol +input = stream +run = (rs / 16 : U32) +count = (rs % 16 : U32) +eob = U32.is_eq(count, 0) && U32.is_lt(run, 15) +zero = U32.is_eq(rs, 240) +pos = (index + run : U32) +ok = jpeg.stream.valid(input) && (eob || (zero && U32.is_le(pos, end)) || (U32.is_gt(count, 0) && U32.is_le(count, 10) && U32.is_le(pos, end))) JPEGRefined{U.choose(U32, eob || Bool.not(ok), U32.inc(end), U32.inc(pos)), U.branch(JPEGBlock, Bool.not(ok), _ => JPEGBlock{jpeg.stream.invalid(input), coefficients, predictor}, _ => U.branch(JPEGBlock, eob, _ => jpeg.progressive.eob(jpeg.bits(input, run), run, coefficients, predictor, 1), _ => U.branch(JPEGBlock, zero, _ => JPEGBlock{input, coefficients, predictor}, _ => jpeg.progressive.ac.bits(jpeg.bits(input, count), count, coefficients, predictor, offset, pos, low))))} Uses (23): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Bool.and https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Bool.not https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Bool.or 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.div https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32.inc https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32.is_eq https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32.is_gt https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32.is_le https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32.is_lt https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32.mod https://jend.leeeet.dev/definition.txt?path=gralha-bytes@0.1.0.1/bytes.bend&name=Bytes https://jend.leeeet.dev/definition.txt?path=gralha-jpeg-decode@0.1.0.1/jpeg.bend&name=JPEGBlock https://jend.leeeet.dev/definition.txt?path=gralha-jpeg-decode@0.1.0.1/jpeg.bend&name=JPEGRead https://jend.leeeet.dev/definition.txt?path=gralha-jpeg-decode@0.1.0.1/jpeg.bend&name=JPEGRefined https://jend.leeeet.dev/definition.txt?path=gralha-jpeg-decode@0.1.0.1/jpeg.bend&name=jpeg.bits https://jend.leeeet.dev/definition.txt?path=gralha-jpeg-decode@0.1.0.1/jpeg.bend&name=jpeg.progressive.ac.bits https://jend.leeeet.dev/definition.txt?path=gralha-jpeg-decode@0.1.0.1/jpeg.bend&name=jpeg.progressive.eob https://jend.leeeet.dev/definition.txt?path=gralha-jpeg-decode@0.1.0.1/jpeg.bend&name=jpeg.stream.invalid https://jend.leeeet.dev/definition.txt?path=gralha-jpeg-decode@0.1.0.1/jpeg.bend&name=jpeg.stream.valid https://jend.leeeet.dev/definition.txt?path=gralha-text-scan@0.1.0.1/scan.bend&name=branch https://jend.leeeet.dev/definition.txt?path=gralha-text-scan@0.1.0.1/scan.bend&name=choose