You can get much better code if you make xrci a bit field.
so the entire bit filed region can be accessed word-wise:


#include <stdint.h>

struct Xrb
{
    uint16_t xrlen;             /* Length of I/O buffer in bytes */
    uint16_t xrbc;              /* Byte count for transfer */
    void * xrloc;               /* Pointer to I/O buffer */
    uint8_t xrci:8;             /* Channel number times 2 for transfer */
    uint32_t xrblk:24;  /* Random access block number */
    uint16_t xrtime;    /* Wait time for terminal input */
    uint16_t xrmod;             /* Modifiers */
};

void test(struct Xrb *XRB)
{
    XRB->xrblk = 5;
}


Bernd.

Reply via email to