<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/84658>84658</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[libc][stdbit] potential typo in type generic macros for `bit_width`, `bit_floor`
</td>
</tr>
<tr>
<th>Labels</th>
<td>
libc
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
Flandini
</td>
</tr>
</table>
<pre>
I think I noticed a potential typo in the stdbit type generic macros for `stdc_bit_width` and `stdc_bit_floor`:
```
#define·stdc_bit_width(x)······················································\$ ··_Generic((x),································································\$
······unsigned·char:·stdc_bit_width_ui,········································\$ <--------
······unsigned·short:·stdc_bit_width_us,·······································\$ ······unsigned:·stdc_bit_width_ui,·············································\$
······unsigned·long:·stdc_bit_width_ul,········································\$
······unsigned·long·long:·stdc_bit_width_ull)(x)$
#define·stdc_bit_floor(x)······················································\$
··_Generic((x),································································\$
······unsigned·char:·stdc_bit_floor_ui,········································\$ <--------
······unsigned·short:·stdc_bit_floor_us,·······································\$
······unsigned:·stdc_bit_floor_ui,·············································\$
······unsigned·long:·stdc_bit_floor_ul,········································\$
······unsigned·long·long:·stdc_bit_floor_ull)(x)$
```
I think the assignment exprs for the assocs for `unsigned char` should refer to the respective `*_uc` functions.
Seems like this is missed by the tests because we only test the `__cplusplus` part of the preprocessor conditional.
I will fix these and add tests for both branches of the preprocessor conditional in `stdbit-macros.h`, let me know if these are actually as expected.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzsWF9v4ygQ_zT4ZdSI4j9JHvywTZTTPt8HiDCMY64ELBhvm29_Mnbuuqv2ttdVVpUSlIwFw5_hNwyMfjJGc3CINSsfWLnN5ECdD_XOSqeNM1nj9an-CtQZ9whfwXkyCjVI6D2hIyMt0Kn3YBxQhxBJN4bGJoQDOgxGwVGq4CO0PgCreCSt9o2h_ZPR1LGKg3T6O0VrvQ-s4iz_wviW8bOs-PybqiLX2BqHbCPYw_KHacXqmYn1pLrJX5LlhokCLldeLrb_YzozTKzOLhSbT4HCNct0Auaoe0f_waUrRU811ckwRvIrUbofzDW6dwoolm_u5vJRaGPnA72JbbwubH_nNfVT99zO-__z20cjwHp3eBNse41g_zqc7wDWpod5fp-L_87Hpmzulo9d2sO31OkzygukTimgrvQpuXTqNGN7janTB5C8Hc2LQ5xqrz_GM9i3LOdDcL4D2FeznB9IqCTP9Bh1CBOfdkRHgM99mGivWeHVPyzY2SJId3zFIXZ-sBoCthiAfBoSMPaoyHzDcQgTX_aDGvu2g1NkvIuLl1b8iXiMYM0jjuZEMBGOJkbU0JzSdISRIjSo5BARnhC8s6fUmtSs4vu96u0Qx_-4Ti8DgW-Ttg_YB68wRh9AeafNaIG0C_geiSdjLbTmeRwUMXF7Uut57XHzjacOmiCd6jD-bHYwbqYGG0N3E5G46BIYG7BIcER4dP4JTHteMCBIRYO09gQyjk5ARagXma5zvc7XMsP6fnnPuViuq1XW1Sg1l-1920olsBTLtlqtijZHJUSBmK8yUwsuCp7ztciLiq8WpV4uq3WzbAWXRV6sWcHxKI1dWPvtuPDhkJkYB6xXRVWuMisbtDHxq0JY0ygmBCu3WajH7nfNcIis4NZEiv9OQIZs4mTTgHLLyocJBFZuX6Ne3-ZbX1KtI2pz05lkzYZg646oj2MgiB0Tu4OhbmgWyh-Z2I0WzZ-7Pvi_UBETu7S_yMQubfHvAAAA__9J_UQ7">