<p dir="ltr"><br>
</p>
<br><div class="gmail_quote"><div dir="ltr">On Tue 28 Jul, 2015 20:24 Kevin Wilson &lt;<a href="mailto:wkevils@gmail.com">wkevils@gmail.com</a>&gt; wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi all,<br>
Is there a kernel API for handling 32 bits ?<br>
I see a macro like BIT(nr)<br>
<a href="http://lxr.free-electrons.com/source/include/linux/bitops.h#L6" rel="noreferrer" target="_blank">http://lxr.free-electrons.com/source/include/linux/bitops.h#L6</a><br>
<br>
#define BIT(nr)                 (1UL &lt;&lt; (nr))<br>
<br>
and also<br>
#define BIT_ULL(nr)             (1ULL &lt;&lt; (nr))<br>
<br>
However, these macros are using 64 bit semantics, so if I will use<br>
them with 32 bits values<br>
the results will  be wrong.<br>
<br>
Any ideas ?<br>
<br>
Regards,<br>
Kevin<br>
<br>
_______________________________________________<br>
Kernelnewbies mailing list<br>
<a href="mailto:Kernelnewbies@kernelnewbies.org" target="_blank">Kernelnewbies@kernelnewbies.org</a><br>
<a href="http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies" rel="noreferrer" target="_blank">http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies</a><br>
</blockquote></div><p dir="ltr">The macros don&#39;t do type checking so it will work for both 32-bit and 64-bit.</p>