2011/8/1 "Kajetan Nürnberger" <Kajetan.Nuernberger@...>:
> But it doesn’t solve the whole Problem.
> In the application we read the bytes from the serial port and store them into a buffer (char array). The data structure doesn’t exist just of double numbers but has also chars float and so on. So the address mod 8 of the double values are not always = 0.
> Has anybody a different solution to this problem? Instead of copy the stream.
The only portable way of doing this is to copy the data (if required).
Anything which doesn't have byte alignment (ints, doubles, floats)
will need to be copied in order for the code to work reliably on all
Some architectures also have endianess issues (x86 is little endian,
the ARM is typically also little endian, although I have used
big-endian ARM in the past).
For your doubles, you'll probably need to worry about endianess as
well. I don't know if its still the case, but I seem to recall that on
the ARM doubles are 8-bytes which are sent as 2 little-endian 4-bytes
words, but the 4-byte entities are in big-endian order.
If you're looking for optimal code for each architecture, then you'll
need to put #if tests in the code and code it up multiple ways. If the
doubles are still the way I described, you're going to need to do a
#if as well.
Shuswap, BC, Canada