I've seen (and discounted) many warnings about using C bitfields cross platform ...

@0h00000000@ioc.exchange

I've seen (and discounted) many warnings about using C bitfields cross platform I thought I knew better.

I repent, and my code is fixed.

//32 bits - infer is first from chunkSequence = 0
typedef struct {
uint8_t packetType;
uint16_t chunkSequence;
uint16_t bitFlagsAndSize;
/*
uint16_t chunkDataLen :11; //max is (MTU size - sizeof(packet_t))
uint16_t fileSequence :2; //rolling increment
uint16_t isLast :1;
uint16_t isRetransmit :2; //retry count
*/
} __attribute__((packed)) packet_t;

=====================

//update header
pFp->packetType=packetType;
pFp->chunkSequence = chunkSequence;
pFp->bitFlagsAndSize = (xLenToSend << 5) | ((udpFileSequence * 0b11) << 3) | ((isLastChunk & 0b1) << 2) ;
//pFp->chunkDataLen = xLenToSend;
//pFp->isLast = isLastChunk;
//pFp->isRetransmit=0;
//pFp->fileSequence = udpFileSequence;
chunkSequence++;