[Tinyos-help] compare bit to bit or byte to byte

Allan McInnes allan.mcinnes at canterbury.ac.nz
Thu Mar 12 14:19:04 PDT 2009


On 13/03/2009, at 7:45 AM, Sonia Pardo wrote:
>
> I think that if I compare bit to bit (0-1) it was easier so I only  
> have to count 0's and 1's.
> Do you know how to convert a string to bits?
>
> For example: If I have 8 in binary (bit to bit) is 1000. But in my  
> case I have a sentence, so I don't know how to convert this in bits?

Sonia, you might want to take a look at bitwise operations [ http://en.wikipedia.org/wiki/Bitwise_operation 
  ]. You can use bitwise operators to compare data in a bit-by-bit  
basis.

Hope that helps.

Allan



More information about the Tinyos-help mailing list