diff options
| author | gingerBill <bill@gingerbill.org> | 2024-02-28 18:24:59 +0000 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2024-02-28 18:24:59 +0000 |
| commit | dce176fa39b34acca49c965809cad97060bf5ff3 (patch) | |
| tree | 4d3012676ddd3f72dd1e28a1a05ced1d1542bfc5 | |
| parent | d1174f66bc76e690c95e7b4cadc5b9607d1344a2 (diff) | |
Remove unnecessary use of `transmute`
| -rw-r--r-- | core/os/os.odin | 6 | ||||
| -rw-r--r-- | core/os/os2/file_util.odin | 6 |
2 files changed, 4 insertions, 8 deletions
diff --git a/core/os/os.odin b/core/os/os.odin index c74712d4e..6d0e22a04 100644 --- a/core/os/os.odin +++ b/core/os/os.odin @@ -160,13 +160,11 @@ write_entire_file :: proc(name: string, data: []byte, truncate := true) -> (succ } write_ptr :: proc(fd: Handle, data: rawptr, len: int) -> (int, Errno) { - s := transmute([]byte)mem.Raw_Slice{data, len} - return write(fd, s) + return write(fd, ([^]byte)(data)[:len]) } read_ptr :: proc(fd: Handle, data: rawptr, len: int) -> (int, Errno) { - s := transmute([]byte)mem.Raw_Slice{data, len} - return read(fd, s) + return read(fd, ([^]byte)(data)[:len]) } heap_allocator_proc :: runtime.heap_allocator_proc diff --git a/core/os/os2/file_util.odin b/core/os/os2/file_util.odin index e52d53f08..11d1f688d 100644 --- a/core/os/os2/file_util.odin +++ b/core/os/os2/file_util.odin @@ -64,13 +64,11 @@ write_encoded_rune :: proc(f: ^File, r: rune) -> (n: int, err: Error) { write_ptr :: proc(f: ^File, data: rawptr, len: int) -> (n: int, err: Error) { - s := transmute([]byte)mem.Raw_Slice{data, len} - return write(f, s) + return write(f, ([^]byte)(data)[:len]) } read_ptr :: proc(f: ^File, data: rawptr, len: int) -> (n: int, err: Error) { - s := transmute([]byte)mem.Raw_Slice{data, len} - return read(f, s) + return read(f, ([^]byte)(data)[:len]) } |