Added C3 port - #178
Open
Bigfoot71 wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
createStatenow 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.fastSqrtnow 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
inttofloatpromotions 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