<p><b>@benpicco</b> commented on this pull request.</p>

<hr>

<p>In <a href="https://github.com/RIOT-OS/RIOT/pull/12238#discussion_r324834916">core/include/bitarithm.h</a>:</p>
<pre style='color:#555'>> @@ -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;                                \
</pre>
<p>Yes - for the get I could get away with a macro to end up at a generic version, but I can't return from a macro so I was hoping <code>unsigned</code> will be enough.</p>
<p>If we can use C11 <code>_Generic</code> in RIOT, maybe this will be the solution here - I don't think any of our tool chains is <em>that</em> old that it would not support it.</p>
<p>I'll see what I can figure out - enjoy your hike!</p>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/RIOT-OS/RIOT/pull/12238?email_source=notifications&email_token=ABE7WYFXLMHJOY47S2GMXMTQJ7JUXA5CNFSM4IW4N2Z2YY3PNVWWK3TUL52HS4DFWFIHK3DMKJSXC5LFON2FEZLWNFSXPKTDN5WW2ZLOORPWSZGOCE3ULNQ#discussion_r324834916">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/ABE7WYA7H5KUONBTH3VYBYLQJ7JUXANCNFSM4IW4N2ZQ">mute the thread</a>.<img src="https://github.com/notifications/beacon/ABE7WYEBKETZ2ODMAO5RFPLQJ7JUXA5CNFSM4IW4N2Z2YY3PNVWWK3TUL52HS4DFWFIHK3DMKJSXC5LFON2FEZLWNFSXPKTDN5WW2ZLOORPWSZGOCE3ULNQ.gif" height="1" width="1" alt="" /></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/RIOT-OS/RIOT/pull/12238?email_source=notifications\u0026email_token=ABE7WYFXLMHJOY47S2GMXMTQJ7JUXA5CNFSM4IW4N2Z2YY3PNVWWK3TUL52HS4DFWFIHK3DMKJSXC5LFON2FEZLWNFSXPKTDN5WW2ZLOORPWSZGOCE3ULNQ#discussion_r324834916",
"url": "https://github.com/RIOT-OS/RIOT/pull/12238?email_source=notifications\u0026email_token=ABE7WYFXLMHJOY47S2GMXMTQJ7JUXA5CNFSM4IW4N2Z2YY3PNVWWK3TUL52HS4DFWFIHK3DMKJSXC5LFON2FEZLWNFSXPKTDN5WW2ZLOORPWSZGOCE3ULNQ#discussion_r324834916",
"name": "View Pull Request"
},
"description": "View this Pull Request on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>