Reputation: 455
Can someone convert this C struct to delphi as in record?
typedef struct {
Uint16 addr2:8;
Uint16 addr1:8;
Uint16 addr4:8;
Uint16 addr3:8;
Uint16 addr6:8;
Uint16 addr5:8;
}MY_ADDR;
I tried it out myslef. But i couldn't figure out how to deal with addr2:8 (:8) issue.
MY_ADDR = record
addr2:8 : Uint16;
addr1:8 : Uint16;
addr4:8 : Uint16;
addr3:8 : Uint16;
addr6:8 : Uint16;
addr5:8 : Uint16;
end;
I am not sure i also need this or not?
pMY_ADDR = ^MY_ADDR;
Upvotes: 2
Views: 629
Reputation: 91270
MY_ADDR = record
addr1 : Byte;
addr2 : Byte;
addr3 : Byte;
addr4 : Byte;
addr5 : Byte;
addr6 : Byte;
end;
You need to swap them around due to byte ordering in MS C bitfields.
Upvotes: 4