On Tue, Aug 4, 2009 at 10:28 AM, Rémi Villé<[email protected]> wrote: > Hi, > > I have implemented a basic aggregation using an array of byte in network > messages. > Sensed values are on 16 bit so I need two entries in this array to write one > value, and I use bitwise shift operators to perform that. > > When I run the application in real mode the values received on the PC are > whatever, but they are good with TOSSIM. > So I think bitwise shift operators haven't the same effect on the PC CPU and > the telosb one, maybe the endianness is not the same. > > I would like to know if it can be an explanation, if one component could > allow to use bitwise shift operators regardless the plateform. > > Thanks, > > Rémi >
Bitwise operations will depend on the endianness of the cpu for what you are doing. If you want it to work correctly across different platforms you could either detect the endianness somehow (google search should help there) or I believe there is some define to detect the platform being used; so you would detect TOSSIM or telosb and have the correct code for each. With that said, I think you are going about this the hard way. TOS already has this figured out (and solved) this sort of problem with platform independent types. Chapter 9 of http://www.tinyos.net/tinyos-2.x/doc/pdf/tinyos-programming.pdf has more information. If you need more help, post the code in question. _______________________________________________ Tinyos-help mailing list [email protected] https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
