3.4 Advantages of Using Bit Masks and Group Configuration Masks
The advantages of using the recommended coding style are:
- Obtaining a more readable code. By using the group configuration mask, the user will know for sure what configuration is being set – the configuration name being contained in the mask name.
- Obtaining a more compact code. The group mask will help the user clear all the bits in a bit field, without the need of using a bit mask for each bit. The configuration mask can also be used to configure the entire bit field.
- The code is easier to maintain. For example, to change a bit field configuration, the user will only have to change the group configuration mask name instead of changing each bit value using bit masks or bit positions.