[riot-notifications] [RIOT-OS/RIOT] core/bitarithm: introduce bitarithm_get/set_masked(), convert pca9685 (#12238)

benpicco notifications at github.com
Mon Sep 16 22:06:33 CEST 2019


benpicco commented on this pull request.



> @@ -163,6 +163,47 @@ static inline unsigned bitarithm_lsb(unsigned v)
 }
 #endif
 
+/**
+ * @brief           Sets the masked bits in a word to the given value.
+ *
+ * @note            The mask should be compile-time constant so the compiler
+ *                  is able to optimize the entire loop away.
+ *
+ * @param       val The value to modify.
+ * @param[in]  mask The bitmask to apply.
+ * @param[in]  bits The new value of the masked bits.
+ *
+ */
+#define bitarithm_set_masked(val, mask, bits) do {                  \
+        const unsigned _mask = mask;                                \

uint8_t was the original use-case, so that makes it 3.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/pull/12238#discussion_r324861542
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20190916/e4428c28/attachment.htm>


More information about the notifications mailing list