Yes, ideally [de]serialize would just work in all cases.
To me the only issue is the mechanics of knowing and communicating the
endianness of a stream. We would have to set a flag on the stream
(gaaaa! more state!!) perhaps, and have a way to indicate it in the
serialized format (though it might be easier to just declare it always
little endian).
Then there is performance. In the case of a big array, I suspect the
fastest thing is to read it as one big chunk, then use the CPU's bswap
on each word in a tight loop. That is where swapping comes into play.
We could also provide read_le(io, T) and read_be(io, T) functions, in
case you really do just want to decode an int or two out of a stream
of known endianness.
> --
>
>
>