I’ve got a stream of data that i’m reading which are float values, but each of the 4-bytes in the value are in byte-reversed order.
That means that
1 reinterpret(Float32, x[1:4]) gives me an invalid value
but
2 reinterpret(Float32, x[4:-1:1]) gives me a valid value
So my plan is to simply create an array of floats and assign each value to result # 2
Can I do that ? I’m not really sure if that is “safe”.
Is there a better way to handle this ?
Thanks!
edit: what i’m currently doing
for i=1:4:n
x[i:i+3] = x[i+3:-1:i]
end
x2 = reinterpret(Float32, x)
return convert(Array{Float64,1}, x2)
Seems to work…