Let's say I have the following files: main.zig and foo.blob
const file /* : *const [N:0]u8 */ = @embedFile("foo.blob");
const ids: *const [N / 8]u64 = /* ... */; // (I don't need null terminator)
aaaaaaaa
Is there a faster way of defining ids then copying the data of file into a comptime array such as in this?
const file = @embedFile("foo.blob");
const ids = blk: {
const fileU64s = std.mem.bytesAsValue(u64, file);
var out: [fileU64s.len]u64 = undefined;
for (fileU64s, 0..) |id, i| {
out[i] = id;
}
break :blk out;
};