Is it possible to do something similar to what I'm attempting here?
fn JS_VALUE_GET_OBJ(v: JSValue) *JSObject {
return @ptrCast(*JSObject, JS_VALUE_GET_PTR(v));
}
fn JS_VALUE_GET_PTR(v: JSValue) *anyopaque {
return v.u.ptr;
}
I get this error:
src/main.zig:95:12: error: cast increases pointer alignment
return @ptrCast(*JSObject, JS_VALUE_GET_PTR(v));
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/main.zig:95:48: note: '*anyopaque' has alignment '1'
return @ptrCast(*JSObject, JS_VALUE_GET_PTR(v));
~~~~~~~~~~~~~~~~^~~
src/main.zig:95:21: note: '*main.JSObject' has alignment '8'
return @ptrCast(*JSObject, JS_VALUE_GET_PTR(v));
^~~~~~~~~
I guess generally I'm curious how you cast *anyopaque to a pointer of another type