Re: [RFCv2 01/16] add basic register-field manipulation macros

2016-08-29 Thread Daniel Borkmann
On 08/29/2016 05:07 PM, Jakub Kicinski wrote: On Mon, 29 Aug 2016 16:34:25 +0200, Daniel Borkmann wrote: On 08/26/2016 08:06 PM, Jakub Kicinski wrote: Common approach to accessing register fields is to define structures or sets of macros containing mask and shift pair. Operations on the

Re: [RFCv2 01/16] add basic register-field manipulation macros

2016-08-29 Thread Jakub Kicinski
On Mon, 29 Aug 2016 16:34:25 +0200, Daniel Borkmann wrote: > On 08/26/2016 08:06 PM, Jakub Kicinski wrote: > > Common approach to accessing register fields is to define > > structures or sets of macros containing mask and shift pair. > > Operations on the register are then performed as follows: >

Re: [RFCv2 01/16] add basic register-field manipulation macros

2016-08-29 Thread Daniel Borkmann
On 08/26/2016 08:06 PM, Jakub Kicinski wrote: Common approach to accessing register fields is to define structures or sets of macros containing mask and shift pair. Operations on the register are then performed as follows: field = (reg >> shift) & mask; reg &= ~(mask << shift); reg |=

[RFCv2 01/16] add basic register-field manipulation macros

2016-08-26 Thread Jakub Kicinski
Common approach to accessing register fields is to define structures or sets of macros containing mask and shift pair. Operations on the register are then performed as follows: field = (reg >> shift) & mask; reg &= ~(mask << shift); reg |= (field & mask) << shift; Defining shift and mask