Bit manipulations good practices
问题 As a beginner C programmer, I am wondering, what would be the best easy-to-read and easy-to-understand solution for setting control bits in a device. Are there any standards ? Any example code to mimic? Google didn't give any reliable answer. For example, I have a control block map: The first way I see would be to simply set the needed bits. It requires a bunch of explanations in comments and seems to be not all that professional. DMA_base_ptr[DMA_CONTROL_OFFS] = 0b10001100; The second way I