Skip to content

Bugfix: fix typo for 255 check in regions.go#389

Open
jplauzie wants to merge 6 commits intomumax:3.11.2from
jplauzie:regionstypo
Open

Bugfix: fix typo for 255 check in regions.go#389
jplauzie wants to merge 6 commits intomumax:3.11.2from
jplauzie:regionstypo

Conversation

@jplauzie
Copy link

I think there may be two typos in the max number of allowed regions?

In regions.Loadfile() and defRegionId(), it checks if regions are >256. However, I believe this should be >=256? Regions allows 256 regions (0-255), but it should not allow 256.

There is a similar typo in the Voronoi example on the website example page: The line:
"defregion(256, circle(N*c).inverse())".

The Setgeom() command in the example moots it, but 256 actually wraps back to region 0. (This PR does not fix this)

JonathanMaes and others added 2 commits March 12, 2026 15:12
Fixes 2 region>255 typos in regions
In regions.Loadfile, this allows region 256 (should be 255), which overflows. Instead of >256 should be >=256. Also changed to NREGIONS instead of 256 for consistency.

Also in defRegionId, > to >=
@JonathanMaes JonathanMaes changed the base branch from master to 3.11.2 March 18, 2026 15:26
@JonathanMaes
Copy link
Contributor

Thanks for noticing this. In the meantime, I also exposed NREGION for use in .mx3 scripts and changed some usage of region 256 to region 0 in test scripts.

@JonathanMaes JonathanMaes requested a review from ilateur March 19, 2026 10:22
@JonathanMaes JonathanMaes modified the milestone: 3.12 Mar 19, 2026
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