Skip to content

float3: drop redundant direct streflop_cond.h include - #3028

Merged
sprunk merged 1 commit into
beyond-all-reason:masterfrom
tomjn:fix/float3-include-order
Jun 18, 2026
Merged

float3: drop redundant direct streflop_cond.h include#3028
sprunk merged 1 commit into
beyond-all-reason:masterfrom
tomjn:fix/float3-include-order

Conversation

@tomjn

@tomjn tomjn commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

What

float3.h included lib/streflop/streflop_cond.h directly. This drops that one include:

 #include "System/BranchPrediction.h"
-#include "lib/streflop/streflop_cond.h"
 #include "System/creg/creg_cond.h"
 #include "System/FastMath.h"
 #include "System/type2.h"

Why

FastMath.h does #define MATH_SQRT_OVERRIDE 1 before it includes streflop_cond.h, so that streflop does not define its own math::sqrt(float) (FastMath provides a faster one). The direct include in float3.h sat ahead of FastMath.h, so streflop_cond.h could be processed before that override was set.

Dropping the direct include lets FastMath.h be the includer of streflop_cond.h (it pulls it in transitively, with the override in place). float3.h still gets streflop via FastMath.h, so nothing else changes.

creg_cond.h keeps its original position — its include tree (creg_cond.h → creg.h → SyncedPrimitive.h) does not reach streflop_cond.h, so it does not need to move.

Why this is cross-platform

No behavior change on any platform; master builds fine today. This just removes a direct include whose ordering bypassed FastMath's MATH_SQRT_OVERRIDE, which is what the macOS port tripped over.

Provenance

Surfaced by the macOS port (#2991, commit cc3cad907f, author Mark Kropf — credited via Co-authored-by). That commit also reordered creg_cond.h; this PR keeps the minimal change (the reorder was unnecessary).

@sprunk

sprunk commented Jun 18, 2026

Copy link
Copy Markdown
Collaborator

why the creg_cond change? looks unrelated

float3.h included lib/streflop/streflop_cond.h directly, ahead of
FastMath.h. FastMath.h defines MATH_SQRT_OVERRIDE before it includes
streflop_cond.h (so streflop does not define its own math::sqrt(float) --
FastMath provides a faster one). The direct include meant streflop_cond.h
could be processed before that override was set.

Drop the direct include; FastMath.h pulls in streflop_cond.h transitively
with the override in place. creg_cond.h keeps its original position --
it does not pull in streflop, so it does not need to move.

Surfaced by the macOS port (beyond-all-reason#2991, commit cc3cad9).

Co-authored-by: Mark Kropf <markkropf@gmail.com>
@tomjn
tomjn force-pushed the fix/float3-include-order branch from 991c9cc to b1c4ebd Compare June 18, 2026 20:35
@tomjn tomjn changed the title float3: include FastMath.h before streflop_cond.h float3: drop redundant direct streflop_cond.h include Jun 18, 2026
@tomjn

tomjn commented Jun 18, 2026

Copy link
Copy Markdown
Contributor Author

@sprunk branch updated, the creg change is gone now

@sprunk
sprunk merged commit 3e83e20 into beyond-all-reason:master Jun 18, 2026
3 checks passed
@sprunk

sprunk commented Jun 18, 2026

Copy link
Copy Markdown
Collaborator

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants