mirror of
https://github.com/IllusionMan1212/tinyvg-odin.git
synced 2026-10-24 10:12:38 +00:00
16 lines
284 B
Odin
16 lines
284 B
Odin
package tinyvg
|
|
|
|
import "core:bytes"
|
|
import "core:io"
|
|
|
|
Reader :: struct {
|
|
using r: bytes.Reader
|
|
}
|
|
|
|
read_data :: #force_inline proc(r: ^Reader, $T: typeid) -> (res: T, err: io.Error) {
|
|
b: [size_of(T)]byte
|
|
|
|
bytes.reader_read(r, b[:]) or_return
|
|
return (^T)(&b[0])^, nil
|
|
}
|