Skip to content

Added C3 port - #178

Open
Bigfoot71 wants to merge 1 commit into
Auburn:masterfrom
Bigfoot71:c3-port
Open

Added C3 port#178
Bigfoot71 wants to merge 1 commit into
Auburn:masterfrom
Bigfoot71:c3-port

Conversation

@Bigfoot71

Copy link
Copy Markdown
Contributor

Hey, I ported FastNoiseLite to C3 for a personal project, sharing it here in case it is useful to someone else.

This version is directly derived from the one written in C, there is two intentional differences from the original:

  • createState now takes an optional seed parameter defaulting to 1337, using C3 default arguments. By the way, the doc comment in the C version mentions this parameter, but it is completely missing from the signature.

  • fastSqrt now calls libm sqrt directly instead of the fast inverse square root hack. That made sense when a fast FPU sqrt was not a given, but I do not think it buys anything on hardware this is likely to run on today.

I also added a few explicit casts where C3 does not do the same implicit int to float promotions as C, no behavior change, just made explicit.

Tested with a small raylib program flipping through every noise type, fractal mode, domain warp mode, cellular distance and return combination, and 2D / 3D generation, running both versions side by side. No visible difference, as expected.

If necessary, I can perform more precise tests.

Here is a short clip of my test:

demo.webm

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.

1 participant