<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/127238>127238</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[libc] casting macro for user headers
</td>
</tr>
<tr>
<th>Labels</th>
<td>
libc
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
nickdesaulniers
</td>
</tr>
</table>
<pre>
@enh-google saw our endian.h and mentioned `__BIONIC_CAST`.
https://android.googlesource.com/platform/bionic/+/main/libc/include/sys/cdefs.h#57
```c++
#if defined(__cplusplus)
#define __BIONIC_CAST(_k,_t,_v) (_k<_t>(_v))
#else
#define __BIONIC_CAST(_k,_t,_v) ((_t) (_v))
#endif
```
maybe interesting to add that to libc/include/__llvm-libc-common.h and use more in our user facing headers.
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJyUkk2P2ywUhX8N3qBYBOIYL7xIZl5Ls3m7aPcWhotNB0PEx1T59xV2pm3UVSV_4GPuo3suR8RoZgfQo-aKmtdK5LT40Dsj3xVEka0zEGI1eXXv0YmAWw6z97MFHMUP7HPA4JQRrl6wcAqv4JLxDhRGZzKO17cv_7-9jC-Xr9_QmdSIXJaUbhGxC6IDooNwKnij6h0ZfQ4SaulXRIebFUn7UJaT8c7IreKK6LAK4xAdrJmKZpy0WQGiQ7xHRAepQMd6QZQ1LSIXdCb7Jbfia5EoMxor0MaBQpSPo7zZHMuNaLdv2P_iZweUj--IvoypPD4Q7fAusSKx_8pHUX9BwEb4V1xR0yf6meaU0X86QuSyivsE2LgEAWIybsbJY6EUTotIZf3XkMbR2o_1UPSD9OvqP08uR8CrD4W2HWuOELAWskAXEApCrCvVM9WxTlTQH1vWNQ0nHa-WnhEg5KQ412cCjeJENIqcZcO0JPyo2sr0lNCG0OPpyNmp4fWkp0kRCdByrZVuS7ZWYWxd2qt9mCsTY4b-SFvKeGXFBDZuIaV0N0VLXEO_2ZnyHNGJWBNT_E1IJtkt2FtB84ql2Ie0Chk81v7h8mGvysH2z_mcTVry9Ehk4T5eh1vw30GmMtrSZgneo9OPnv4MAAD__4YWCZ8">