Bitfield data type

Discussion in 'C-Bus Serial Protocols' started by CABrouwes, Apr 16, 2013.

  1. CABrouwes

    CABrouwes

    Joined:
    Apr 25, 2009
    Messages:
    86
    Likes Received:
    2
    Location:
    New York Area
    Some variables in the cbus c library are defined as bitfield. I am trying to compile these libraries with a compiler that does not include the bitfield type.
    Does any know know if I can replace the type of this variables with regular int ? It could be that the bitfield type is used to save memory space ... or it could be that there is some "clever" use pointers somewhere in the code that manipulates several bitfield variables as one int.
     
    CABrouwes, Apr 16, 2013
    #1
  2. CABrouwes

    ashleigh Moderator

    Joined:
    Aug 4, 2004
    Messages:
    2,392
    Likes Received:
    24
    Location:
    Adelaide, South Australia
    The bitfields are used to save space on small micros.

    You can remove the ": n" part in each declaration, which allocates a certain number of bits.

    The RAM usage will blow out by doing this, but it should otherwise work fine.
     
    ashleigh, Apr 17, 2013
    #2
  3. CABrouwes

    CABrouwes

    Joined:
    Apr 25, 2009
    Messages:
    86
    Likes Received:
    2
    Location:
    New York Area
    Thanks
     
    CABrouwes, Apr 19, 2013
    #3
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.