Hi Dave,
DK>GW> Yes, but as you are only storeing 8 bits in each int, and for most of
DK>GW> us an int is either 16 or 32 bits long you need to make that:
DK>GW>
DK>GW> SigRecieved.e = ( (s) >> 24 ) & 0xff;
DK>GW> SigRecieved.f = ( (s) >> 16 ) & 0xff;
DK>GW> SigRecieved.g = ( (s) >> 8 ) & 0xff;
DK>GW> SigRecieved.h = ( (s) ) & 0xff;
DK>GW>
DK>GW> otherwise you may find SigRecieved.h contains a copy of the input
ata,
DK>GW> which may or may not be a problem depending on how the code uses it.
DK>My int is also 16 bits. You are the third person to say that I need to
DK>add the '0xff'. Exactly what does it do?
Masks off any unwanted bits (above the 8 required).
DK>You might see a previous post on this. As of yet the results seem to
DK>be the same with or with out it.
Your post with the question had the SigRecieved.e etc (you made me
look twice, that should be SigReceived) declared as int, which is why I
made the response. In your subsequent post you had them as char, so then
the "& 0xff" is technically not required.
George
* SLMR 2.1a * I before E except after C - What a weird society!
--- Maximus/2 3.01
---------------
* Origin: DoNoR/2,Woking UK (44-1483-717905) (2:440/4)
|