projects
/
onyx.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
8c55c1c
)
bugfix with new implementation of `io.read_bytes`
author
Brendan Hansen
<brendan.f.hansen@gmail.com>
Fri, 22 Sep 2023 02:18:39 +0000
(21:18 -0500)
committer
Brendan Hansen
<brendan.f.hansen@gmail.com>
Fri, 22 Sep 2023 02:18:39 +0000
(21:18 -0500)
core/io/reader.onyx
patch
|
blob
|
history
diff --git
a/core/io/reader.onyx
b/core/io/reader.onyx
index 9e9a8fdf3ed1a7b4a0f174a8f80f7a390ef025b7..6858f47cce10f043cc002d4c12832ce659b459a9 100644
(file)
--- a/
core/io/reader.onyx
+++ b/
core/io/reader.onyx
@@
-170,8
+170,8
@@
read_bytes :: (use reader: &Reader, bytes: [] u8) -> (i32, Error) {
write_index := 0;
while n > 0 && !reader_empty(reader) {
- if start
!=
end {
- to_write := math.min(n, end);
+ if start
<
end {
+ to_write := math.min(n, end
- start
);
memory.copy(bytes.data + write_index, buffer.data + start, to_write);
n -= to_write;
write_index += to_write;