Merge pull request #1160 from he32/shift-overflow-fix

ArenaAlloc/arenaallocimpl.h: avoid shift overflow on 32-bit hosts.
pull/1170/head
Tim Stack 1 year ago committed by GitHub
commit f98f1e52c9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -13,6 +13,8 @@
#include <stdio.h>
#endif
#include <stdint.h>
namespace ArenaAlloc
{
@ -108,7 +110,9 @@ namespace ArenaAlloc
value |= value >> 4;
value |= value >> 8;
value |= value >> 16;
#if SIZE_MAX > UINT32_MAX
value |= value >> 32;
#endif
return value + 1;
}

Loading…
Cancel
Save