I am having a lot of trouble trying to read and write values from memory. I am attempting to write a binary format, which seems like something that should be easy in a systems programming language.
in C it's somewhat painful but you can dereference a pointer and assign it to a value and cast anything to anything.
In node.js it's dead simple to do what I want value=buffer.readDoubleLE(offset)
in zig I'm really scratching my head. I see there are methods to read int (which involve some wrestling with alignment)
I just want to be able to take a value and put it into a suitable size buffer, and vice versa.
The best I've found is that I can write any value into memory using @memcpy(buf, mem.asBytes(&value)); //&@as([@sizeOf(T)]u8, @bitCast(value))); (not worried about endianness I know I'm gonna be on LE)