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:
@@ -3,6 +3,9 @@
|
||||
;;; map matches to the pixel, padding included.
|
||||
|
||||
(include stdio.h stdlib.h string.h time.h)
|
||||
;; TODO sex#58: import only the modules used here once an import brings
|
||||
;; the types its interface needs; until then, every dependency, in
|
||||
;; dependency order.
|
||||
(import maps)
|
||||
(import lcg)
|
||||
(import noise)
|
||||
@@ -215,12 +218,19 @@
|
||||
(if (== d 0) (++ matched))
|
||||
(if (!= d 0)
|
||||
(do
|
||||
;; TODO sex#59: sum two (if ...)s once a conditional
|
||||
;; operand keeps its parentheses.
|
||||
(var cls int 0)
|
||||
(if (< d 0) (+= cls 2))
|
||||
(if (>= got (. t sea-level)) (+= cls 1))
|
||||
(++ [by-class cls])))
|
||||
;; -4..+4, the ends counting everything beyond
|
||||
(var bucket int (+ (if (< d -4) -4 (if (> d 4) 4 d)) 4))
|
||||
;; TODO sex#59: clamp inline once a conditional operand keeps its
|
||||
;; parentheses.
|
||||
(var clamped int d)
|
||||
(if (< clamped -4) (= clamped -4))
|
||||
(if (> clamped 4) (= clamped 4))
|
||||
(var bucket int (+ clamped 4))
|
||||
(++ [by-delta bucket])
|
||||
(var colour u32 (grey (/ (* got 255) (. g settings size-y))))
|
||||
(if (> d 0) (= colour 16719904))
|
||||
|
||||
Reference in New Issue
Block a user