Dear Andreas, Do you have a handy list of places which convert netmasks to lengths? Regardless of what one might do with min_log2, we ought to clean up those places in time for the 20.05 release (if possible).
Dave From: vpp-dev@lists.fd.io <vpp-dev@lists.fd.io> On Behalf Of Andreas Schultz Sent: Tuesday, May 12, 2020 5:42 AM To: vpp-dev <vpp-dev@lists.fd.io> Subject: [vpp-dev] min_log2 abuse Hi, There are few places in VPP (most notable when trying to convert a netmask into a length) that can pass 0 (zero) into min_log2 and expect to get a meaningful result. Obviously log2(0) is undefined. It turns out that this also applies to the return of min_log2. Under the hood the function uses __builtin_clzl, and the return of that function is also undefined for input 0. __builtin_clzl could be replaced with __builtin_ia32_lzcnt_u64 on supported CPUs to avoid the undefined behaviour. That would still not fix the problem that passing 0 into a log function is broken by design. Any comments? Andreas -- Andreas Schultz
-=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#16326): https://lists.fd.io/g/vpp-dev/message/16326 Mute This Topic: https://lists.fd.io/mt/74155196/21656 Group Owner: vpp-dev+ow...@lists.fd.io Unsubscribe: https://lists.fd.io/g/vpp-dev/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-