Re: Question about GTK+ and timers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Igor,

On Fri, 8 Apr 2011 18:08:30 -0700 you wrote:
> So, what is the best course of action?
> I just tested the program on the device and on x86. On x86 it produced correct
> results, whereas on the ARM device it didn't.
> So it looks like I will have to switch the endianess when running on the ARM?
> 
When talking to a remote device over a serial port, what you are
receiving is fundamentally a byte stream, so the best way to handle it
is to admit that in your code. Read it into an array of (unsigned)
char, do any formatting / alignment checks that you can, and then
extract the data into the variables you want it in. If there are raw
binary values of more than one byte, extract them explicitly:

   MyWordVal = buf[2] + ( buf[3] * 256 );  /* data stream is little endian */

This is portable and clear to any future maintainer. The efficiency
loss is negligible.

Cheers,
Rob
_______________________________________________
gtk-list mailing list
gtk-list@xxxxxxxxx
http://mail.gnome.org/mailman/listinfo/gtk-list


[Index of Archives]     [Touch Screen Library]     [GIMP Users]     [Gnome]     [KDE]     [Yosemite News]     [Steve's Art]

  Powered by Linux