fix four conditional operands sexc emitted without parentheses, and mark every Sex workaround with a TODO

A conditional as an operand loses its parentheses (sex#59): box-blur
allocated a quarter of its buffer, deep water got the shallow colour,
and verify's delta histogram wrote out of bounds into the height
classes. Plan.org quoted the corrupted count.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-08 21:01:59 +03:00
parent 39b0e74f2b
commit c14c154303
22 changed files with 156 additions and 5 deletions

View File

@@ -8,6 +8,8 @@
(pub include stddef.h)
(include string.h)
;; TODO sex#46: make these a (pub enum wire ...) once explicit enum
;; values are kebab-converted.
(pub define WIRE-VARINT 0)
(pub define WIRE-FIXED64 1)
(pub define WIRE-BYTES 2)
@@ -15,6 +17,8 @@
(pub record pb ((p (* const u8)) (end (* const u8)) (err bool)))
;; TODO sex#44: the methods are ordered so each calls only those above
;; it; order them by topic once a method can call one below.
(ops pb
(pub fn of ((data (* const void)) (len size-t)) pb
(var p (* const u8) data)
@@ -37,6 +41,8 @@
(break))
(var b u8 (* (. self p)))
(++ (. self p))
;; TODO sex#47: write the varint masks in hex once there are hex
;; literals.
(c-bit-or= v (<< (cast (& b 127) u64) shift))
(if (< b 128)
(return v)))
@@ -60,6 +66,8 @@
;; string, or a packed array.
(pub fn bytes ((self (* pb))) pb
(var len u64 (.varint self))
;; TODO sex#45: use (. self p) in the literals once member access
;; inside a compound literal follows the pointer.
(var p (* const u8) (. self p))
(if (> len (.len self))
(do