From 4f8ef2140e5c41913f3f2ab49c554c6548609684 Mon Sep 17 00:00:00 2001 From: Symious <14933944+symious@users.noreply.github.com> Date: Thu, 10 Sep 2026 02:59:59 +0800 Subject: Fix stale copy-pasted comment on BoolNode's phiCon call (#249) The three comment lines above `AddNode.phiCon(this, ...)` in BoolNode were copy-pasted from MulNode and never adapted: they use `*` as the operator and describe the rotated shape `(x * (phi cons)) * con`. For BoolNode neither is right. The operator is a compare, and in chapters 6-9 `rotate` is hard-coded `false`, so the rotated shape is never matched; the shapes actually handled are `(phi cons) cmp con` and `(phi cons) cmp (phi cons)`. Reword the comment accordingly, and in chapters 6-9 add a line noting why rotate is off. Chapters 10-25 pass `this instanceof EQ`, so no such claim is made there. Comment-only change; no code is touched. Co-authored-by: Claude Opus 5 --- chapter22/src/main/java/com/seaofnodes/simple/node/BoolNode.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'chapter22') diff --git a/chapter22/src/main/java/com/seaofnodes/simple/node/BoolNode.java b/chapter22/src/main/java/com/seaofnodes/simple/node/BoolNode.java index 301e1517..0cf8b87e 100644 --- a/chapter22/src/main/java/com/seaofnodes/simple/node/BoolNode.java +++ b/chapter22/src/main/java/com/seaofnodes/simple/node/BoolNode.java @@ -71,9 +71,9 @@ abstract public class BoolNode extends Node { return new NotNode(in(1)); } - // Do we have ((x * (phi cons)) * con) ? - // Do we have ((x * (phi cons)) * (phi cons)) ? - // Push constant up through the phi: x * (phi con0*con0 con1*con1...) + // Do we have ((phi cons) cmp con) ? + // Do we have ((phi cons) cmp (phi cons)) ? + // Push the compare up through the phi: (phi con0 cmp con, con1 cmp con...) Node phicon = AddNode.phiCon(this,this instanceof EQ); if( phicon!=null ) return phicon; -- cgit v1.2.3