{"id":26925261,"url":"https://github.com/badsami/bad","last_synced_at":"2025-04-02T02:33:58.798Z","repository":{"id":170583438,"uuid":"450647398","full_name":"badsami/bad","owner":"badsami","description":"A C/C++ SIMD math library for video game programming and connected fields, targeting x86, x86-64 and ARM architectures.","archived":false,"fork":false,"pushed_at":"2022-12-31T09:35:16.000Z","size":346,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-23T17:28:30.094Z","etag":null,"topics":["game-programming","low-level","math","optimization","simd","video-game-development"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/badsami.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-01-21T21:38:47.000Z","updated_at":"2022-09-29T13:15:30.000Z","dependencies_parsed_at":"2024-08-07T10:53:23.740Z","dependency_job_id":null,"html_url":"https://github.com/badsami/bad","commit_stats":null,"previous_names":["bad-sam/bad","badsami/bad"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/badsami%2Fbad","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/badsami%2Fbad/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/badsami%2Fbad/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/badsami%2Fbad/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/badsami","download_url":"https://codeload.github.com/badsami/bad/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246744165,"owners_count":20826675,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["game-programming","low-level","math","optimization","simd","video-game-development"],"created_at":"2025-04-02T02:33:58.217Z","updated_at":"2025-04-02T02:33:58.784Z","avatar_url":"https://github.com/badsami.png","language":"C","readme":"# bad\n\nA C/C++ SIMD math library for video game programming and connected fields, targeting x86, x86-64 and ARM architectures. `bad` aims at providing a math library, but might be extended to offer systems, modules and algorithms commonly used in the video game industry (collision, physics, etc.).\n\n\n## Disclaimer\nBecause I am working on this library primarily to learn, it is a work in progress in its early days. It is missing a lot of features and may contain dirty and incorrect code.\n\n\n## Goals of the library\n- Provide a cross-platform optimized API\n- Compile with Clang, GCC and MSVC\n- Compile and run under Windows and Linux\n- Both C and C++ compatible\n- Take advantage of the available SIMD instruction sets\n- Offer the best performance for mathematics (and other modules and algorithms commonly found in the video game industry) for low energy consumption\n- Provide a library with no dependencies that relies as little as possible on the standard C/C++ library\n\n\n## Current state of the library\n- Tested on a laptop with an AMD x86-64 CPU (Ryzen 7 5800H)\n- Compiled with Clang for both C and C++\n- Compiled under Windows 10\n- C++ compatible\n- Takes advantage of MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, AVX, AVX2 and FMA intrinsics\n- Contains only common single-precision floating-point vector operations\n- Has no dependency, but relies on `stdint.h`\n\n\n## Repository overview\n- [`src/bad/`](src/bad/): the library. If you want to use `bad` in your project, this is probably the only directory you need\n    - [`common/`](src/bad/common/): common operations likely to be used throughout the rest of the library\n    - [`detect/`](src/bad/detect/): context detection around the library\n    - [`math/`](src/bad/math/): math functions\n    - [`types/`](src/bad/types/): where scalar, simd and math types are defined. No functions are contained here, only declarations\n    - [`bad.h`](src/bad/bad.h): included accross all headers, currently used solely for wrapping sources in an optional namespace\n    - [`debug.h`](src/bad/debug_checks.h): debug-mode runtime checks through macros\n    - [`qualifiers.h`](src/bad/qualifiers.h): a variety of qualifiers used to affect how the compiler generates code\n- [`test/`](test/): unit tests on important and/or non-trivial functions\n- [`build.bat`](build.bat/): custom compilation script for Windows 10 with Clang. Can be called with `build` to build the library, `build test`, `build asm`, `build run`, `build clean`\n- [`RESOURCES.md`](RESOURCES.md): a collection of knowledge that helped me learn\n\n\n## To do\nGeneral:\n- [X] Work on C/C++ interoperability\n- [ ] Work on Linux support\n- [ ] Support compilation with GCC and MSVC\n- [ ] Support compilation under ARM\n- [ ] Add support for more SIMD instruction sets? (RISC-V \"V\", PowerPC's AltiVec, MIPS' MSA, ARM's Helium?)\n- [ ] Take endianness in consideration\n\nCommon:\n- [X] Implement `f32xn` and `maskn`, a general vector type built on top of the most suited SIMD ISA available for the needs of the user\n- [ ] Explore non-temporal loads and stores\n- [X] Explore possible implementation of types whose size is not a multiple of the available vector width (vec2 and vec3 for instance)\n- [X] Remove the dependency on `stdint.h` if possible in [`types.h`](src/bad/types.h)\n- [ ] Learn about interoperability and penalties between ISA (SSE \u003c--\u003e AVX for instance), and manage them\n\nTests:\n- [ ] Extend tests to all functions, trivial or not\n- [ ] Improve testing framework?\n\nMath:\n- [X] Migrate calculus/mathematical functions in `common/f32x4.h` to `math`\n- [ ] Implement common calculus functions such as power, exponential, log, tan...\n- [X] Implement 4-dimensional vector\n- [X] Implement 3-dimensional vector\n- [X] Implement quaternion\n- [ ] Implement 4x4, 3x4 and 3x3 matrices\n- [ ] Implement math types conversion functions\n- [ ] Implement common splines\n\nCollisions \u0026 intersections:\n- [ ] Implement shapes\n- [ ] Implement collision algorithms\n\nPhysics:\n- [ ] Implement kinematic\n\n\n## License\n`bad` is licensed under the [MIT license](LICENSE)","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbadsami%2Fbad","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbadsami%2Fbad","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbadsami%2Fbad/lists"}