Hi, Am 28. Oktober 2016 10:03:17 MESZ, schrieb Juergen Stuber <[email protected]>: >Hi Neil, hi everybody, > >On Thu, 27 Oct 2016 11:33:57 +0100 >Neil Jones <[email protected]> wrote: >> >> are you suggesting the compiler generated code for accessing the >> bitfeilds is less size efficient than doing it manually? I would be >> suprised if that was the case ? > >writing to a bitfield translates to a read followed by a write of the >updated value. So if you write to multiple bitfields in a register you >have multiple read-write pairs. These can't be combined when the >bitfields are volatile. Similar for multiple reads of a register. > >When you use shift and mask you usually do a single access for >all fields of a register. > >IMHO it is also better to use shift and mask because a write to a >bitfield is actually a hidden non-atomic read-update-write, which >may become dangerous when you have concurrent access.
Maybe I misunderstood you, but I would be very surprised if shift and mask is atomic. Cheers, Ludwig _______________________________________________ devel mailing list [email protected] https://lists.riot-os.org/mailman/listinfo/devel
