Commit Graph

16055 Commits

Author SHA1 Message Date
Laytan Laats
679d306d0f panic on transpose with result type in diff layout
Partially reverts 4db4841, it should behave the same as cast (which does
an implicit transpose).
2025-11-29 20:06:43 +01:00
Jeroen van Rijn
5db9afd73b Merge pull request #5963 from Yawning/feature/chacha8rand
runtime: Use chacha8rand as the default RNG (BREAKING)
2025-11-29 14:38:22 +00:00
laytan
4db4841413 fix matrix transpose with different result type
Fixes #5623
2025-11-29 12:14:06 +01:00
Jeroen van Rijn
31817be087 Fix #5975
Fix `err` shadowing in test runner. Fixes #5975.
2025-11-29 11:57:34 +01:00
Yawning Angel
3e8e0bb110 tests/benchmark: Add RNG benchmarks 2025-11-29 16:16:52 +09:00
Yawning Angel
aa8e6e0938 tests: Add random number generator tests 2025-11-29 16:16:52 +09:00
Yawning Angel
ea1f1e275d base/runtime: Add chacha8rand as the default RNG 2025-11-29 16:16:52 +09:00
Yawning Angel
e1ba69ea51 base/runtime: Add rand_bytes and HAS_RAND_BYTES
Having the OS/runtime provide a cryptographic entropy source is the
right thing to do, and we need it to initialize the default random
number generator.
2025-11-29 10:45:53 +09:00
Yawning Angel
0bd6410ea3 examples/demo: Set the RNG to xoshiro256
The example should run on any target, not just first class ones.
2025-11-29 10:45:53 +09:00
Yawning Angel
73883b70c8 testing: Use xoshiro256** instead of the runtime RNG
While platforms that do not have an entropy source have no rights,
use something that is always guaranteed to work.
2025-11-29 10:45:53 +09:00
Yawning Angel
f74f93154a math/rand: Add xoshiro256**
This is extracted from the previos PR as an improved non-cryptographic
PRNG option.
2025-11-29 10:45:53 +09:00
Yawning Angel
110d869cd7 math/rand: Add a copy of the existing PCG PRNG
The switch to the new RNG will be a breaking change as the outputted
sequence will change for a given seed.  This is intended for backward
compatibility purposes only.
2025-11-29 10:45:53 +09:00
Jeroen van Rijn
cbf9f59da0 Fix core:math/ease 2025-11-28 23:18:28 +01:00
Jeroen van Rijn
976bb52af7 Always use new itoa method when MATH_BIG_FORCE_32_BIT 2025-11-28 23:08:17 +01:00
gingerBill
dd20a587e8 Merge pull request #5973 from FrancisTheCat/master
Fix #5967 (Incorrect stack overflow warning for by ref switches over unions)
2025-11-28 13:10:23 +00:00
Franz
ba9b9eacb5 Fix #5967 (Incorrect stack overflow warning for by ref switches over unions) 2025-11-28 13:55:07 +01:00
Jeroen van Rijn
03b1b551c4 Merge pull request #5972 from Xotchkass/rand_range
`math/rand`: Add range-based number generation procedures
2025-11-28 12:23:01 +00:00
Xotchkass
b8f8e6a8df changed panic to assert 2025-11-28 14:11:37 +02:00
Xotchkass
a234f25fa5 Add range-based random number generation functions 2025-11-28 13:40:30 +02:00
gingerBill
b4367e8e42 Merge pull request #5970 from blob1807/master
Fix `is_pointer_internally` not handling Named Types.
2025-11-28 09:24:43 +00:00
blob1807
062f445ee3 Fix is_pointer_internally not handling Named Types. 2025-11-28 13:02:49 +10:00
Jeroen van Rijn
be38ba58b3 Another little bit faster. 2025-11-27 18:27:55 +01:00
Jeroen van Rijn
a6820020c7 Merge pull request #5968 from Xotchkass/rand_u_max
Add `uint32_max`, `uint64_max`, `uint128_max` and `uint_max` procs to `core:math/rand`
2025-11-27 16:12:09 +00:00
Jeroen van Rijn
1efbe5f36a Merge pull request #5969 from Kelimion/faster_big_itoa
Faster `big.itoa`.
2025-11-27 15:55:29 +00:00
Jeroen van Rijn
eff32e18a7 Also test a big int with a large number of zeroes. 2025-11-27 16:32:27 +01:00
Jeroen van Rijn
3cdaf06fc8 Switch between old and new itoa method based on optimization level + digit size 2025-11-27 16:10:32 +01:00
Jeroen van Rijn
1ea5990be2 Speed up big.itoa
Extract 18 (64-bit) or 8 (32-bit) digits per big division.
This gives a 2.5x speedup for a 1024-bit bigint.
2025-11-27 15:35:05 +01:00
gingerBill
78d8059ebe Use @(rodata) where possible 2025-11-27 10:24:22 +00:00
gingerBill
bf43dbaf5a Add @(require_results) to core:time 2025-11-27 10:14:21 +00:00
gingerBill
0b4884ada4 Update test generator 2025-11-27 09:21:54 +00:00
gingerBill
0d16ab2783 Add alias Okay = None 2025-11-27 09:14:39 +00:00
gingerBill
c63fa3f663 Use < 0 instead of == -1 for comparisons 2025-11-27 09:13:21 +00:00
gingerBill
53876907c6 Handle Allocator_Error correctly in core:math/big 2025-11-27 09:10:03 +00:00
gingerBill
49634246c5 Merge branch 'master' of https://github.com/odin-lang/Odin 2025-11-27 09:06:36 +00:00
gingerBill
5380cf8b90 core:fmt lvalues in for loops to minimize stack usage 2025-11-27 09:06:30 +00:00
Xotchkass
0ed24953bb add uint32_max, uint64_max, uint128_max and uint_max procs to math/rand 2025-11-26 23:06:19 +02:00
gingerBill
f48e87d77d Merge pull request #5930 from odin-lang/bill/os2-file-stream
`os2.File_Stream`
2025-11-26 15:04:55 +00:00
gingerBill
5caaefddb1 Merge pull request #5966 from benjryan/sio_udp_connreset
Add SIO_UDP_CONNRESET winsock constant
2025-11-26 11:37:39 +00:00
Ben Ryan
e2a0f4417f Add SIO_UDP_CONNRESET winsock constant 2025-11-26 20:40:38 +11:00
bc-universe
9712624e04 Implement more Linux syscalls (#5705)
* Implement some more Linux syscalls

* Fixed typo and removed stray comments

* Correct types for some syscalls

* Fix types and add variadic argument for prctl

* flag fixes

* when x86/amd64 only

* more fixes

---------

Co-authored-by: Laytan Laats <laytanlaats@hotmail.com>
2025-11-24 12:14:17 +01:00
gingerBill
5e3648b83c Merge pull request #5956 from thePHTest/master
add math.sign and math.sign_bit overloads for int types
2025-11-23 21:17:04 +00:00
Laytan
2f6f24d839 Merge pull request #5800 from IllusionMan1212/xlib-IM
vendor/xlib: a few more IM-related procedures and constants
2025-11-23 21:07:20 +01:00
Jeroen van Rijn
97e423f199 Merge pull request #5959 from laytan/remove-terminate-from-demo
remove terminate from demo
2025-11-23 19:29:15 +00:00
Phil Homan
342a7dd112 rerrange math.sign and math.sign_bit overloads 2025-11-23 11:03:37 -08:00
Laytan Laats
95a37dd340 remove terminate from demo
This was causing deadlocks because:

1. The main thread would `thread.terminate` a running thread
2. `thread.terminate` does not mean termination happens immediately
3. The thread that was terminated would see that the main thread
   released `print_mutex` and acquire it
4. The worker would execute `fmt.printf` which is a cancellation point
5. Cancellation point reached, cancelled
6. Deadlock because the thread was holding `print_mutex`

You would usually solve this with `pthread_cleanup_push` that would
release the mutex in case it is cancelled, or use
`pthread_setcancelstate` to disable cancellation while the mutex is
held. But the real fix is just not using forced termination and using a
flag or other mechanism to indicate to the thread it should stop.

`thread.terminate` shouldn't even be a thing IMO.
It is way to dangerous and if somebody knows what they are doing they
can use the core:sys procedures to achieve it.

And we certainly shouldn't be using it in the demo as an example.
2025-11-23 19:48:03 +01:00
gingerBill
cd490bd35d Merge pull request #5958 from A1029384756/master
moved checking of -vet-unused-procedures and -vet-packages flags to after all flags are parsed
2025-11-23 09:49:16 +00:00
A1029384756
411a5b6401 moved checking of -vet-unused-procedures and -vet-packages flags to
after all flags are parsed
2025-11-22 23:08:23 -05:00
Phil Homan
9131bca7ba add math.sign and math.sign_bit overloads for int types 2025-11-22 13:32:21 -08:00
gingerBill
a162626f2b Use BUF_SIZE 2025-11-22 21:18:43 +00:00
gingerBill
a71917a96a Merge pull request #5941 from odin-lang/bill/typeid-sip-hash
Use SIP hash as name canonicalization hash
2025-11-22 16:55:20 +00:00