Good, because a bitshift should be a bitshift no matter the endianess,
although some may run into {un}signed extension issues...

MS


Rémi Villé wrote:
> 2009/8/4 Alan Marchiori <[email protected] <mailto:[email protected]>>
> 
>     On Tue, Aug 4, 2009 at 10:28 AM, Rémi Villé<[email protected]
>     <mailto:[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.
> 
> 
> Thanks for your help, but  I shamefully admit that I just forgot to use 
> Par sensor instead of Demo one :( (On TOSSIM the data sensed were 
> randomly simulated but not in real mode).
> 
> So there's no problem with endianness.
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Tinyos-help mailing list
> [email protected]
> https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to