Commit Graph

50 Commits

Author SHA1 Message Date
Jeroen van Rijn
5c95a48bc7 Clean up core:math/big
- Deprecate the u64/u32 implementation so we can use fewer nails and have an easier time of maintaining and optimizing the package going forward. The remaining implementation still works on 32-bit targets, it's just a smidge less efficient.

- Use only 1 nail instead of 4. The tests now run 3.5% faster as a result.

Future optimizations may including using fully packed backing (no nails) using `intrinsics.overflow_*` to handle borrow and carry safely.
2026-02-15 17:00:53 +01:00
Jeroen van Rijn
d8f2eb2717 Remove core:mem import from core:math/big. 2026-02-12 14:37:28 +01:00
gingerBill
78d8059ebe Use @(rodata) where possible 2025-11-27 10:24:22 +00:00
gingerBill
c63fa3f663 Use < 0 instead of == -1 for comparisons 2025-11-27 09:13:21 +00:00
Jeroen van Rijn
56aab55d82 Fix #5931
Fix #5931 and add test case for it.
2025-11-18 15:37:57 +01:00
gingerBill
842cfee0f3 Change Odin's LICENSE to zlib from BSD 3-clause
This change was made in order to allow things produced with Odin and using Odin's core library, to not require the LICENSE to also be distributed alongside the binary form.
2025-10-28 14:38:25 +00:00
Jeroen van Rijn
c4c2431997 Package lines for core:math and more. 2025-10-09 19:56:21 +02:00
Jeroen van Rijn
4b36306674 Deprecate old @(deprecated) things. 2025-06-06 10:42:34 +02:00
Jeroen van Rijn
476d0087c8 Fix bug in div3 fast path. 2024-06-29 23:14:12 +02:00
gingerBill
e296d6fb90 Fix loads of indentation issues with mixing spaces and tabs 2024-06-29 19:50:51 +01:00
Jeroen van Rijn
db03c86544 Fix typo in big.internal_invmod
Fixes #3253
2024-03-08 18:05:34 +01:00
gingerBill
3e7e779abf Replace core:* to base:* where appropriate 2024-01-28 22:18:51 +00:00
gingerBill
5023313c03 Minor cleanups to the core library 2023-09-30 20:26:04 +01:00
gingerBill
c85ac955f7 Simplify docs to hide the copyright 2022-01-17 19:00:47 +00:00
Jeroen van Rijn
938744b276 [math/big] Rename internal_int_shl_digit to _private_int_shl_leg.
Same for the SHR variant. These are pure implementation details to shift by a leg/word at a time.
Prevent accidental usage.
2021-12-11 15:22:24 +01:00
Jeroen van Rijn
fbebf4bc4e big: Add Python implementation of LCM. 2021-09-07 14:17:14 +02:00
gingerBill
2800d4b8d0 Merge branch 'master' into optional-semicolons 2021-09-06 16:46:57 +01:00
Jeroen van Rijn
f2c5c26f2c big: Add internal_int_prime_next_prime. 2021-09-04 16:31:05 +02:00
Jeroen van Rijn
31918d3b8f big: Add internal_int_is_prime. 2021-09-02 18:31:08 +02:00
Jeroen van Rijn
671b413b15 big: Use new comparison helpers. 2021-09-01 19:13:47 +02:00
Jeroen van Rijn
fd83cbf40b big: Add ilog2. 2021-09-01 19:13:47 +02:00
Jeroen van Rijn
a056e19434 big: Cue up internal_int_exponent_mod wrapper function. 2021-09-01 19:13:47 +02:00
Jeroen van Rijn
2110778040 big: Add internal_int_exponent_mod_fast. 2021-09-01 19:13:47 +02:00
Jeroen van Rijn
65a15e9c06 big: Add internal_int_exponent_mod. 2021-09-01 19:13:47 +02:00
gingerBill
720884e0f1 Strip even more semicolons if followed by a } or ) on the same line 2021-08-31 23:47:57 +01:00
gingerBill
f57201bbd1 Remove unneeded semicolons from the core library 2021-08-31 22:32:53 +01:00
gingerBill
251da264ed Remove unneeded semicolons from the core library 2021-08-31 22:21:13 +01:00
Jeroen van Rijn
737b4fde1c big: Add _private_int_mul_balance. 2021-08-28 18:17:57 +02:00
Jeroen van Rijn
2cfd6b7024 big: Add _private_int_mul_high. 2021-08-28 14:59:13 +02:00
Jeroen van Rijn
852643e6ba Add tests for `internal_int_is_square'. 2021-08-28 13:27:46 +02:00
Jeroen van Rijn
ec4cae4f04 big: Add int_is_square. 2021-08-27 16:41:16 +02:00
Jeroen van Rijn
33df335ec9 big: Add internal_int_montgomery_calc_normalization. 2021-08-27 16:41:16 +02:00
Jeroen van Rijn
893cc013b5 big: Add Montgomery reduction. 2021-08-27 16:41:16 +02:00
Jeroen van Rijn
23d29be4d8 big: Update license to BSD-3. 2021-08-19 12:12:59 +02:00
Jeroen van Rijn
1ad0743a52 big: Nicely align test suite results. 2021-08-19 12:12:59 +02:00
Jeroen van Rijn
5fd7a5f32a big: Fix signed multiplication for some inputs. 2021-08-18 15:24:43 +02:00
Jeroen van Rijn
706e58c1c7 big: Add _private_int_mul_toom`. 2021-08-16 21:17:21 +02:00
Jeroen van Rijn
8b49bbb0fc big: Add _private_mul_karatsuba. 2021-08-16 16:10:10 +02:00
gingerBill
e3fef2dade Improve parsing for or_return; allow #force_inline foo() or_return; 2021-08-16 11:58:50 +01:00
gingerBill
c27b8a71fd Replace err != nil with or_return where appropriate 2021-08-15 17:52:10 +01:00
Jeroen van Rijn
dc02566a84 big: Add _private_int_div_recursive. 2021-08-13 23:45:00 +02:00
Jeroen van Rijn
f72a0de074 big: Add inverse mod. 2021-08-13 01:41:33 +02:00
Jeroen van Rijn
851780b8f4 big: Add arguments and usage to test.py. 2021-08-11 20:59:54 +02:00
Jeroen van Rijn
5f34ff9f9f big: Add _private_int_sqr_toom. 2021-08-11 20:59:54 +02:00
Jeroen van Rijn
2b274fefbb big: Add _private_int_sqr_karatsuba. 2021-08-11 20:59:54 +02:00
Jeroen van Rijn
6c681b258c big: Add _private_int_sqr_comba. 2021-08-11 20:59:54 +02:00
Jeroen van Rijn
1f91a2fe65 big: Finish refactor. 2021-08-11 20:59:54 +02:00
Jeroen van Rijn
19ff27788c big: Refactoring. 2021-08-11 20:59:54 +02:00
Jeroen van Rijn
6d34a8344a big: Refactor helpers. 2021-08-11 20:59:53 +02:00
Jeroen van Rijn
40b7b9ecdf big: Refactor exponents and such. 2021-08-11 20:59:53 +02:00