Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow tomsfastmath to be built without stdlib #34

Draft
wants to merge 3 commits into
base: develop
Choose a base branch
from

Commits on Jan 6, 2024

  1. Use variable-length array instead of malloc/free.

    The only use of `malloc`/`free` in tomfastmath is in
    src/numtheory/fp_prime_random_ex.c, and the size required can be
    calculated from the function arguments, so we can just use
    a variable-length automatic array instead.
    
    Variable-length automatic arrays are a C99 feature, and TFM already doesn’t
    compile as C90, so we might as well take advantage of it.
    ryancdotorg committed Jan 6, 2024
    Configuration menu
    Copy the full SHA
    37a4155 View commit details
    Browse the repository at this point in the history
  2. remove snprintf/strncat/strlen from fp_ident

    fp_ident is the only place tomsfast math uses string manipulation
    functions when built as a library. This commit replaces them with
    safe, trivial functions for concatonating static strings and numbers
    together.
    ryancdotorg committed Jan 6, 2024
    Configuration menu
    Copy the full SHA
    cab9b8f View commit details
    Browse the repository at this point in the history
  3. allow tomsfastmath to be built without stdlib

    This commit enables tomsfastmath to be built with
    `--no-standard-libraries` provided `TFM_NO_STDLIB` is defined, which
    happens automatically if a web assembly build target is detected.
    
    The only functionality this disables is the `fp_rand` function.
    ryancdotorg committed Jan 6, 2024
    Configuration menu
    Copy the full SHA
    9118790 View commit details
    Browse the repository at this point in the history