On Thu, Apr 09, 2015 at 10:04:39AM +0100, Peter Maydell wrote: > On 9 April 2015 at 09:55, Edgar E. Iglesias <edgar.igles...@gmail.com> wrote: > > Did you consider using a struct here? > > e.g: > > > > typedef struct MemTxAttrs { > > unsigned int secure : 1; > > unsigned int master_id : 10; > > unsigned int etc : 1; > > } MemTxAttrs; > > > > I think you could still pass it by value and my understanding is > > that the compiler will generate similar code. > > We discussed this last time round, I think. Whether structs get > passed in registers depends on the host CPU ABI/calling convention.
Ah sorry, I must have missed that response... > > > I find it more readable, you ca go: > > > > attrs.secure = 1; > > attrs.master_id = 0x77; > > if (!attrs.secure) > > > > instead of: > > > > attrs |= MEMTXATTRS_SECURE > > if (!(attrs & MEMTXATTRS_SECURE)) > > > > etc... > > > > Or do you see any disadvantages with this? > > I prefer the traditional integer-and-bitops approach, then you > know what you're getting everywhere... OK :-) Cheers, Edgar