<div dir="ltr"><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Aug 16, 2014 at 8:01 PM, Hans Wennborg <span dir="ltr"><<a href="mailto:hans@chromium.org" target="_blank">hans@chromium.org</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div id=":1m6" class="a3s" style="overflow:hidden">We already handle the no-slabs case when checking whether the current slab is large enough: if no slabs have been allocated, CurPtr and End are both 0. alignPtr(0), will still be 0, and so "if (Ptr + Size <= End)" fails.<br>

<br>
I measured a 1.5% speed-up with "perf stat -r10 clang -fsyntax-only -w gcc.c".<br></div></blockquote><div><br></div><div>LGTM, please submit.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div id=":1m6" class="a3s" style="overflow:hidden">
<br>
The thing I'd like review for is whether "Ptr + Size <= End" is strictly correct. It seems to me that Ptr + Size would often point outside the slab object (especially now when Ptr can be 0), and that comparing that with End would be undefined behaviour. Perhaps we should really be using intptr_t here?</div>
</blockquote></div><br>Technically, yes... but it can't possibly matter. ;]<br></div><div class="gmail_extra"><br></div><div class="gmail_extra">The correct fix is to compare the difference of Ptr and End to Size, not to use intptr_t. Feel free to submit that too if you like. =]</div>
</div>