memcpy(view->shadow_data.color, (float[]) {1.0f, 0.0f, 0.0f, 1.0f}, sizeof(float[4]));
I'm trying to translate this line to zig and I attempted to use @memcpy. Memcpy macro complained that I wasn't passing a *u8. I didn't quite understand why I can't pass a *f64?
I eventually came up with this:
@intToPtr(*f64, @ptrToInt(shadow_data.color) + (0 * @sizeOf(f64))).* = 1.0;
@intToPtr(*f64, @ptrToInt(shadow_data.color) + (1 * @sizeOf(f64))).* = 0.0;
@intToPtr(*f64, @ptrToInt(shadow_data.color) + (2 * @sizeOf(f64))).* = 0.0;
@intToPtr(*f64, @ptrToInt(shadow_data.color) + (3 * @sizeOf(f64))).* = 1.0;
Obviously this doesn't feel quite right and neither does this function correctly. Is there something obvious I'm doing wrong?