<br><br><div class="gmail_quote">On Tue, Nov 13, 2012 at 9:47 AM, Riku Palomäki <span dir="ltr"><<a href="mailto:riku@multitouch.fi" target="_blank">riku@multitouch.fi</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi,<br>
<br>
uintptr_t SrcMgr::FileInfo::Data is used to store both a pointer value<br>
and some additional flags. getContentCache-function tries to get only<br>
the raw pointer value from Data, but fails to do so since it uses<br>
wrong size int. At least on Windows 8 with 64-bit Visual Studio 2012<br>
this function always returns corrupted pointers.<br>
<br>
On some platforms unsigned long long would be actually too large for<br>
this use. If this triggers a warning on gcc, maybe it should be<br>
written like ~uintptr_t(7UL).<br>
<br>
Btw, why on earth would you like to store pointers and additional<br>
flags to the same variable, ran out of bits?<br>
<span class="HOEnZb"><font color="#888888"><br>
--<br>
Riku Palomäki<br>
MultiTouch<br>
</font></span><br></blockquote><div><br>The LLVM and Clang compilers are highly optimized for speed and low-memory consumption, so classes that tend to be instantiated "en masse" often contain either bit fields or pack bits into the pointers.<br>
<br>I would suggest using ~uintptr_t, just to be on the safe side, however I am unsure about the suffix of the literal in this case. I believe no suffix at all would be safe given the cast.<br><br>-- Matthieu<br></div></div>