mirror of
https://github.com/odin-lang/Odin.git
synced 2026-04-20 05:20:28 +00:00
Add reader_read_* utilities for slices and rawptr
This commit is contained in:
@@ -68,7 +68,17 @@ reader_read_slice :: proc(r: ^Reader, slice: $T/[]$S) -> (n: int, err: io.Error)
|
||||
|
||||
reader_read_slice_at :: proc(r: ^Reader, slice: $T/[]$S, off: i64) -> (n: int, err: io.Error) {
|
||||
b := ([^]byte)(raw_data(slice))[:len(slice)*size_of(S)]
|
||||
return reader_read_at(r, b, offset)
|
||||
return reader_read_at(r, b, off)
|
||||
}
|
||||
|
||||
reader_read_ptr :: proc(r: ^Reader, data: rawptr, len: int) -> (n: int, err: io.Error) {
|
||||
b := ([^]byte)(data)[:len]
|
||||
return reader_read(r, b)
|
||||
}
|
||||
|
||||
reader_read_ptr_at :: proc(r: ^Reader, data: rawptr, len: int, off: i64) -> (n: int, err: io.Error) {
|
||||
b := ([^]byte)(data)[:len]
|
||||
return reader_read_at(r, b, off)
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user