<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/74260>74260</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
`libc/src/string/memory_utils/utils.h`: warning: implicit conversion loses integer precision: `unsigned long long` to `size_t`
</td>
</tr>
<tr>
<th>Labels</th>
<td>
libc
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
petrhosek
</td>
</tr>
</table>
<pre>
I'm seeing the following warnings when building libc for the baremetal riscv32 target:
```
In file included from /usr/local/google/home/phosek/llvm/llvm-project/libc/src/stdio/vsnprintf.cpp:12:
In file included from /usr/local/google/home/phosek/llvm/llvm-project/libc/src/stdio/printf_core/printf_main.h:13:
In file included from /usr/local/google/home/phosek/llvm/llvm-project/libc/src/stdio/printf_core/writer.h:15:
In file included from /usr/local/google/home/phosek/llvm/llvm-project/libc/src/string/memory_utils/inline_memcpy.h:14:
/usr/local/google/home/phosek/llvm/llvm-project/libc/src/string/memory_utils/utils.h:50:36: warning: implicit conversion loses integer precision: 'unsigned long long' to 'size_t' (aka 'unsigned int') [-Wshorten-64-to-32]
50 | return value == 0 ? value : 1ULL << log2s(value);
| ~~~~~~ ~~~~~^~~~~~~~~~~~~~~
/usr/local/google/home/phosek/llvm/llvm-project/libc/src/string/memory_utils/utils.h:56:50: warning: implicit conversion loses integer precision: 'unsigned long long' to 'size_t' (aka 'unsigned int') [-Wshorten-64-to-32]
56 | return is_power2_or_zero(value) ? value : 1ULL << (log2s(value) + 1);
| ~~~~~~ ~~~~~^~~~~~~~~~~~~~~~~~~~~
2 warnings generated.
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzUVU2P4zYM_TX0hUggU7GcHHzITGpggb0WPQb-YGx1ZcmQ5ASzh_3thZzZTrOYFigKTFvCsExREB_4Hs0mBD1Y5gqKJyhOWbPE0flq5uhHF_hL1rr-pfoEVE4YmLUdMI6MF2eMuyXv1nir7RDwNrLFdtGmT9tGtx1enF9Pt43niWNj0OvQXSVhbPzAEeQRxAnEEZS4P3j3P1m8aMOobWeWnnu8eDchUL0ED1Qb1zUGqB6cGwwD1aOb0jKvkNMBc51el83s3a_cxeTqtgOqg1_fsdcOqL4GO3tt42XbzTPIY04gjx8P447h3DnPb97UaLsdEyj5HwB18zqyv-MpPhiP13YAqieenH85L1GbAFRra7Tl88RTN7_cge3egH0IhHVdUxcC5FGqlP-1J9KnnmajOx2xc_bKPmhn0bjAAbWNPLDH2XOn0_6KnMrFrh3Zo3Gpj1zKWmJ0KRb0Vz7H5APtmy_Nw3ltUwTogFA8bX4Jo_OR7UbtNtFtJEFxei0MIhYCoXxGRM9x8RavjVkYQZ5AnlAgyPr3rSPmP3_-jCCfQT6jcQMFoP0aBTqAfPp-6_3Cb6vhu7aGoPjp24P9S3Sp75z9H-hSj3TpcJ7djT2dnT9_Ze_-wMhfkAe0_5E_BHrC_JHI1R7YfJ-4B_robRIMbNk3kfvtD3_3rK9kf5CHJuMqL0WudnKfq2ysZJnLtuykuoi9ag79Qai2zamVsmB52XWZrkiQzElIokLkais72h_KCyvVF4c97WAneGq02SZVbJ0fMh3CwlW5IyUy07RswjrjiO5CSQXOfLWKqF2GADthdIjh7YKoo-EKlPhbylL_VFJKvCMpJVZJKfEqKSWyxZtqjHEOaYpSnRpGx3Fpt52b_rRJ1qIkuGtdfgsAAP__gjWSNA">