Merge pull request #411 from jserv/predict-alloc_size

Add branch hint for _mi_os_good_alloc_size
This commit is contained in:
Daan 2021-06-07 16:55:39 -07:00 committed by GitHub
commit cd633b2e2a
WARNING! Although there is a key with this ID in the database it does not verify this commit! This commit is SUSPICIOUS.
GPG key ID: 4AEE18F83AFDEB23

View file

@ -113,7 +113,7 @@ size_t _mi_os_good_alloc_size(size_t size) {
else if (size < 8*MiB) align_size = 256*KiB;
else if (size < 32*MiB) align_size = 1*MiB;
else align_size = 4*MiB;
if (size >= (SIZE_MAX - align_size)) return size; // possible overflow?
if (mi_unlikely(size >= (SIZE_MAX - align_size))) return size; // possible overflow?
return _mi_align_up(size, align_size);
}