Casting a slice of char to float

Slicing an array gives you a slice, but you need an array to bitcast. Deferencing a slice with a comptime-known length will give you an array, like so:

const to: f32 = @bitCast(from[i..][0..4].*);
1 Like