68 Commits

Author SHA1 Message Date
Jeroen van Rijn
27667ce36b iff -> if and only if (⟺) 2026-03-13 11:54:15 +01:00
Shane Shrybman
0ffd740583 core:bytes add loc := #caller_location 2026-02-22 10:18:04 -05:00
gingerBill
ad6cde0b3c Add reader_read_* utilities for slices and rawptr 2026-02-17 14:57:50 +00:00
gingerBill
96d6eec8e5 Add reader_read_slice and reader_read_slice_at 2026-02-17 14:55:59 +00:00
gingerBill
966b76c4cb Add write_slice/read_slice utility procedures to core:bytes, core:io, and core:os 2026-02-17 14:34:28 +00:00
Shane Shrybman
3d9441c394 Update the comment on core:bytes.compare() to match the proc signature 2026-02-14 15:15:50 -05:00
Jeroen van Rijn
f8767e58c5 Fix #6267 2026-02-13 11:10:37 +01:00
jakubtomsu
53cb56cc21 remove core:mem dependency from core:bytes 2026-02-10 18:48:22 +01:00
gingerBill
e4fcebe4bf Empty -> Unsupported 2025-11-14 11:17:38 +00:00
Jeroen van Rijn
7a9ea3ee6d Further overhaul of package line comments. 2025-10-09 23:05:29 +02:00
Jeroen van Rijn
248b0fe9e1 More package lines 2025-10-09 16:11:33 +02:00
gingerBill
3e8f4e080c Add more doc lines 2025-10-09 12:26:35 +01:00
gingerBill
20e67f2ad9 Add some more docs 2025-10-07 14:27:19 +01:00
Feoramund
45219f240e Rename SIMD_IS_EMULATED to capability-affirmative HAS_HARDWARE_SIMD 2025-05-29 17:17:51 -04:00
Laytan Laats
5ae27c6ebc wasm: support more vendor libraries
Adds support for:
- box2d
- cgltf
- stb image
- stb rect pack
2024-09-09 18:49:13 +02:00
laytan
a99e57c62c bytes: fix last_index_byte off-by-one 2024-09-05 13:30:46 +02:00
Feoramund
f453054aff Return 0, nil in all io cases where an empty slice is provided 2024-08-28 19:53:20 +02:00
Feoramund
6798d15ecb Check int(abs) instead to avoid overflows 2024-08-28 19:53:20 +02:00
Feoramund
e83b982afe Measure bytes.Buffer size by length instead of capacity 2024-08-28 19:53:20 +02:00
Feoramund
7c6cc81041 Add Seek behavior to bytes.Buffer 2024-08-28 19:53:20 +02:00
Feoramund
521e47ffee Don't invalidate prev_rune if Reader seek failed 2024-08-28 19:53:20 +02:00
Feoramund
8251f4d7d0 Return .EOF in bytes.buffer_read_at instead
This is consistent with the other stream `read` procs
2024-08-28 19:53:20 +02:00
Feoramund
da49f7eb4e Make bytes.reader_init return an io.Stream
Makes the API like the other stream `init` procs.
2024-08-28 19:53:20 +02:00
Feoramund
981a2e1a00 Add missing io.Stream_Mode responses 2024-08-28 19:53:19 +02:00
Rory OConnell
97795ff3a2 fix simd var typo 2024-08-19 15:50:42 -07:00
Yawning Angel
9e65e229d0 core/bytes: Tweak index_byte and last_index_byte
- Assume unaligned loads are cheap
- Explicilty use 256-bit or 128-bit SIMD to avoid AVX512
- Limit "vectorized" scanning to 128-bits if SIMD is emulated via SWAR
- Add a few more benchmark cases
2024-08-19 11:40:36 +09:00
gingerBill
62911539cd Minor style change 2024-08-13 14:27:25 +01:00
Feoramund
5d5addd48f Set SIMD_SCAN_WIDTH based on size_of(uintptr) 2024-08-10 07:43:14 -04:00
Feoramund
c69fa87d53 Merge core:simd/util into core:bytes 2024-08-10 07:17:03 -04:00
Feoramund
0d29cc3375 Use for x in y construct for bytes iteration
This cannot be applied to the `strings` version, as that would cause a
rune-by-rune iteration, not a byte-by-byte one.
2024-08-09 18:54:04 -04:00
Feoramund
c8a62ee4ec Make simd_util index procs contextless where applicable 2024-08-09 18:54:04 -04:00
Feoramund
12dd0cb72a Simplify and make simd_util cross-platform
This new algorithm uses a Scalar->Vector->Scalar iteration loop which
requires no masking off of any incomplete data chunks.

Also, the width was reduced to 32 bytes instead of 64, as I found this
to be about as fast as the previous 64-byte x86 version.
2024-08-09 18:54:04 -04:00
Feoramund
f66fcd9acb Use vectorized index_* procs in core 2024-08-06 15:19:05 -04:00
Yawning Angel
dcaf085bfa core/bytes: Add alias and alias_inexactly 2024-07-16 01:29:43 +09:00
Jeroen van Rijn
a27b167218 Update tests\core\encoding\cbor to use new test runner.
It was leaky and required a substantial number of `loc := #caller_location` additions to parts of the core library to make it easier to track down how and where it leaked.

The tests now run fine multi-threaded.
2024-06-02 14:47:07 -04:00
Laytan Laats
d3bd1c2110 improve some Negative_Read/Negative_Write logic
Returns the actual error if one is set, instead of swallowing it for the
less descriptive negative error.

Also fixes a out-of-bounds slice error in `bufio.writer_write` because
it wasn't checking the returned `m`.
2024-04-25 19:08:48 +02:00
FourteenBrush
05e27fa92d Fix typo in bytes.scrub 2024-01-17 13:37:06 +01:00
Jeroen van Rijn
99d6a077fe _buffer_grow: Preserve allocator if already set via init_buffer_allocator
Fixes #2756
2023-08-18 22:16:59 +02:00
gingerBill
3f6775e29b Update to new io interface 2023-06-08 16:35:24 +01:00
Laytan Laats
7a04b7262e fix bytes.buffer_init_allocator not using given allocator if len/cap is 0 2023-05-09 21:25:15 +02:00
gingerBill
c4d19dfa92 Use uint instead of int to improve code generation for bounds checking 2022-09-27 22:31:46 +01:00
gingerBill
f50fc33749 Clean up of the core library to make the stream vtables not be pointers directly. 2022-09-15 10:00:50 +01:00
gingerBill
d3081bd889 Add buffer_read_ptr and buffer_write_ptr 2022-07-14 15:26:50 +01:00
gingerBill
33895b6d92 Convert all uses of *_from_slice to *_from_bytes where appropriate 2022-05-16 01:43:43 +01:00
gingerBill
ccb38c3dc6 Add _safe versions 2022-05-12 12:54:14 +01:00
gingerBill
2e7157ae9c Correct bytes._split_iterator 2022-02-14 11:01:34 +00:00
gingerBill
f561147190 Correct _split_iterator 2022-02-14 10:57:29 +00:00
gingerBill
a032a2ef32 Remove the hidden NUL byte past the end from bytes.clone 2022-01-01 15:33:19 +00:00
gingerBill
85f8c8df91 Fix fields_proc in strings and bytes 2021-12-11 12:04:34 +00:00
gingerBill
251da264ed Remove unneeded semicolons from the core library 2021-08-31 22:21:13 +01:00