{"id":39907020,"url":"https://github.com/mrunbelievable92/maxmath","last_synced_at":"2026-01-18T16:00:59.987Z","repository":{"id":48572881,"uuid":"314303709","full_name":"MrUnbelievable92/MaxMath","owner":"MrUnbelievable92","description":"A supplementary SIMD math library to Unity.Mathematics, extending it to all C# numeric types while adding many new types and functions. Written entirely with hardware intrinsics, using Unity.Burst.","archived":false,"fork":false,"pushed_at":"2025-03-23T00:59:02.000Z","size":4715,"stargazers_count":126,"open_issues_count":1,"forks_count":10,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-23T01:31:48.507Z","etag":null,"topics":["avx2","byte","long","mathematics","matrix","sbyte","short","simd","simd-math-library","sse","ulong","unity","ushort","vector"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/MrUnbelievable92.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2020-11-19T16:21:22.000Z","updated_at":"2025-03-23T00:59:05.000Z","dependencies_parsed_at":"2024-01-14T01:07:15.973Z","dependency_job_id":"fe040b55-f8b6-4de0-ae80-635b84c8acef","html_url":"https://github.com/MrUnbelievable92/MaxMath","commit_stats":null,"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"purl":"pkg:github/MrUnbelievable92/MaxMath","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MrUnbelievable92%2FMaxMath","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MrUnbelievable92%2FMaxMath/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MrUnbelievable92%2FMaxMath/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MrUnbelievable92%2FMaxMath/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MrUnbelievable92","download_url":"https://codeload.github.com/MrUnbelievable92/MaxMath/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MrUnbelievable92%2FMaxMath/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28541066,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-18T14:59:57.589Z","status":"ssl_error","status_checked_at":"2026-01-18T14:59:46.540Z","response_time":98,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["avx2","byte","long","mathematics","matrix","sbyte","short","simd","simd-math-library","sse","ulong","unity","ushort","vector"],"created_at":"2026-01-18T16:00:27.551Z","updated_at":"2026-01-18T16:00:59.940Z","avatar_url":"https://github.com/MrUnbelievable92.png","language":"C#","funding_links":["https://www.paypal.com/donate/?hosted_button_id=MARSK3E7WZP9C"],"categories":[],"sub_categories":[],"readme":"# MaxMath\nMaxMath is the most powerful and extensive SIMD math library available to Unity developers. Built on top of Unity.Mathematics and utilizing Unity.Burst, it introduces the following key features:\n\n- **Support For All Primitive Data Types:** MaxMath adds support for `(s)byte`, `(u)short`, and `(u)long` vectors and matrices. These data types come with optimized overloads for all functions in Unity.Mathematics. Additionally, specialized `Random8/16/32/64/128` types are available for efficient pseudo-random number generation.\n- **Wider Vectors With Full Hardware Support:** Vector types are expanded to 256 bits, enabling types like `byte32`, `short16`, `int8`, and `float8`. This allows you to leverage the full potential of SIMD computation.\n- **Many Additional Functions:** MaxMath includes a massive library of mathematical functions not found in Unity.Mathematics, with about five times as many highly optimized functions at your disposal. Each function is fully documented with XML annotations. A full list is provided further below.\n- **Exotic Data Types:** MaxMath introduces data types such as `(U)Int128` (scalar only), 128-bit `quadruple` precision floats (scalar only), and 8-bit `quarter` precision floats (in both scalar and vector forms). Additionally, `Divider\u003cT\u003e` offers highly optimized integer division operations, extending and outperforming specialized libraries like libdivide.\n- **Written Entirely With Hardware Intrinsics:** MaxMath guarantees optimal performance by utilizing specialized CPU instructions for both ARM and x86 ISAs, while abstracting these complexities away from the user entirely.\n- **Extends The Burst Compiler:** MaxMath integrates deeply with Unity.Burst and LLVM, leveraging `Unity.Burst.CompilerServices.Constant.IsConstantExpression\u003cT\u003e()` to include code typically only found in optimizing compilers. This functionality allows MaxMath to choose more optimized code paths at compile time, and users can influence this behavior via the optional `Promise` enum parameter available in many functions.\n- **Easy To Use:** MaxMath is just as easy to use as Unity.Mathematics. It supports features like `implicit` and `explicit` type conversions, making it seamless for you to use if you expect typical C# behavior of primitive types.\n- **Extensive Test Coverage:** MaxMath is backed by 250,000 lines of unit tests for its 400,000 lines of code, as well as `DEBUG` only runtime checks where appropriate, together ensuring it is _production ready_.\n\n\n# How To Use This Library\n\n![alt text](https://i.imgur.com/0Bpr1Mo.png)\n\n## New Types\n\n### Integer\n\u003cdetails\u003e\u003csummary\u003e(S)Byte\u003c/summary\u003e\n  \n![alt text](https://i.imgur.com/LwxZifi.png)\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\u003csummary\u003e(U)Short\u003c/summary\u003e\n  \n![alt text](https://i.imgur.com/yE5o3RH.png)\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\u003csummary\u003e(U)Int\u003c/summary\u003e\n  \n![alt text](https://i.imgur.com/XNzK5iS.png)\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\u003csummary\u003e(U)Long\u003c/summary\u003e\n  \n![alt text](https://i.imgur.com/D0WUfrU.png)\n\n\u003c/details\u003e\n\n### Floating Point\n\n\u003cdetails\u003e\u003csummary\u003eFloat\u003c/summary\u003e\n  \n![alt text](https://i.imgur.com/4lSuEfU.png)\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\u003csummary\u003eHalf\u003c/summary\u003e\n  \n![alt text](https://i.imgur.com/Vk0jQCh.png)\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\u003csummary\u003eQuarter (8-bit 1.3.4.-3 IEEE 754 floating point)\u003c/summary\u003e\n  \n![alt text](https://i.imgur.com/yRbyPGK.png)\n\n\u003c/details\u003e\n\n### Random Number Generators\n\n\u003cdetails\u003e\u003csummary\u003eXOR-Shift\u003c/summary\u003e\n  \n![alt text](https://i.imgur.com/2tYbxk0.png)\n\n\u003c/details\u003e\n\n## New Functions\n\n\n\u003cdetails\u003e\u003csummary\u003eMiscellaneous\u003c/summary\u003e\n  \n![alt text](https://i.imgur.com/AhLKvAb.png)\n\n\u003c/details\u003e\n\n\n\u003cdetails\u003e\u003csummary\u003eArithmetic\u003c/summary\u003e\n\n![alt text](https://i.imgur.com/YU2dSj5.png)\n\n![alt text](https://i.imgur.com/r1f44Va.png)\n\n![alt text](https://i.imgur.com/JUbYL6J.png)\n\n![alt text](https://i.imgur.com/KDvHC11.png)\n\n![alt text](https://i.imgur.com/WoDaxIU.png)\n\n![alt text](https://i.imgur.com/3XJYuqw.png)\n\n\u003c/details\u003e\n\n\n\u003cdetails\u003e\u003csummary\u003eBitwise Operations\u003c/summary\u003e\n\n![alt text](https://i.imgur.com/FDnjd0F.png)\n\n![alt text](https://i.imgur.com/z0MtnUs.png)\n\n![alt text](https://i.imgur.com/knaC0q4.png)\n\n![alt text](https://i.imgur.com/QwP5AWu.png)\n\n\u003c/details\u003e\n\n\n\u003cdetails\u003e\u003csummary\u003eVector Operations\u003c/summary\u003e\n\n![alt text](https://i.imgur.com/uG3k5Re.png)\n\n![alt text](https://i.imgur.com/tGIhgcr.png)\n\n![alt text](https://i.imgur.com/UeUvlii.png)\n\n![alt text](https://i.imgur.com/pGU76Lu.png)\n\n\u003c/details\u003e\n\n\n\u003cdetails\u003e\u003csummary\u003eInterpolation and Geometry\u003c/summary\u003e\n\n![alt text](https://i.imgur.com/S6zfZ5O.png)\n\n![alt text](https://i.imgur.com/6txRQQe.png)\n\n![alt text](https://i.imgur.com/N0pgppX.png)\n\n\u003c/details\u003e\n\n\n\u003cdetails\u003e\u003csummary\u003eType Conversion\u003c/summary\u003e\n\n![alt text](https://i.imgur.com/q1uEpb2.png)\n\n\u003c/details\u003e\n\n\n# What Kind Of Performance To Expect\n\n![alt text](https://i.imgur.com/Bi79n4Q.jpg)\n\n### Highlights\n\n- Division and modulo operations of (s)byte and (u)short vectors _by_ _other_ _vectors_ are implemented as either a long division algorithm ((s)byte32, (s)byte16 and (s)byte8 if not compiling for Avx2) or reciprocal multiplication after converting the vectors to float vectors (up to (s)byte8, all (u)short vectors) - it is very fast and, of course, 100% accurate!\n\n- This library uses Wojciech Mula's SIMD population count algorithm. You can count the amount of set bits of a contiguous block of memory very efficiently using either the (s)byte32 (Avx2) or (s)byte16 (Ssse3) type\n\n### Notes\n\n- It is recommended, just like with Unity.Mathematics, to use vector types that use up an entire SIMD register (128 and 256 bits, respectively). LLVM has a very hard time optimizing code which does not follow this recommendation\n\n# How To Install This Library\n\nDisclaimer: I firmly believe in open source - being able to copy/modify/understand other people's code is great :)\nI also want people to be able to step through code with a debugger.\nFor these reasons I usually don't distribute DLLs.\n\n- Download the package and unzip it into your \"LocalPackages\" folder, which is located at the root folder of your Unity project (where your \"Assets\" folder resides at).\n- Start up Unity. Usually Unity detects new packages and will generate .meta files for you.\n- In case that doesn't work, open up the package manager from within Unity and click on the '+' symbol at the upper left corner of the window, further clicking on \"Add package from disk...\" - \"Add package from git URL\" should also work.\n\n![alt text](https://i.imgur.com/QcqF96e.png)\n\n- Locate the library's \"package.json\" file\n- DONE! \n\n# Donations\n\nIf this repository has been valuable to your projects and you'd like to support my work, consider making a donation.\n\n[![donateBTC](https://github.com/MrUnbelievable92/MaxMath/blob/master/donate_bitcoin.png)](https://raw.githubusercontent.com/MrUnbelievable92/MaxMath/master/bitcoin_address.txt)\n[![donatePP](https://github.com/MrUnbelievable92/MaxMath/blob/master/donate_paypal.png)](https://www.paypal.com/donate/?hosted_button_id=MARSK3E7WZP9C)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrunbelievable92%2Fmaxmath","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmrunbelievable92%2Fmaxmath","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrunbelievable92%2Fmaxmath/lists"}