This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Is this portable code?

Does this code port well to a 16 bit machine (written on 32 bit machine)?

int code     = 0x10 ;
int marker   = 0x20 ;
unsigned long frame;

int main(void)
{
        frame = (unsigned short)~marker<<11 | (unsigned short)code<<5 | marker;
        frame|= (unsigned long)~code<<16 ;

Parents
  • "You should also consider using typedefs to ensure the bit widths that are not compiler/architecture dependent."

    Alas, the OP's toolset is "None", but since I read comments about 32-bit, I could assume ARM and in which case, there is stdint.h which should provide width-specific type definitions.

Reply
  • "You should also consider using typedefs to ensure the bit widths that are not compiler/architecture dependent."

    Alas, the OP's toolset is "None", but since I read comments about 32-bit, I could assume ARM and in which case, there is stdint.h which should provide width-specific type definitions.

Children