memcopy! and memset! intrinsics

This commit is contained in:
2026-07-20 22:53:04 +02:00
parent 297f2e3078
commit dd00af7731
11 changed files with 729 additions and 11 deletions
+14
View File
@@ -934,6 +934,20 @@
- fields without defaults remain required; C-layout records, unions, tuples, and anonymous
generated structs do not accept defaults
45. typed memory intrinsics (implemented)
- `memcopy!` copies equal-length, non-overlapping slices or pointers-to-arrays with identical
element types; comptime diagnoses invalid regions and runtime guards length, size, and overlap
- `memset!` fills a mutable region with a value coerced to its element type; bytes lower to LLVM
memset and wider values use typed stores
- both operations evaluate operands once, preserve undefined state without observing it, and work
identically during comptime evaluation; zeroing is `memset!(destination, 0)`
- `std/mem` aligned reallocation uses `memcopy!`
46. fix `EnumFieldStruct` in `std/meta`
- currently, the `|info|` `.enum` payload capture doesn't preserve the comptime-ness in the match statement
this results in having to type other values in the scope like `[field!(typeinfo!(E), "enum").fields.len]mut []u8`
which is obviously absurd
## A word on unchecked casts
For casts that bypass safety checks, Honey provides builtin functions: