[cfe-dev] BitstreamReader::GetCurrentBitNo() counterintuitive

Zhongxing Xu xuzhongxing at gmail.com
Tue Dec 23 17:01:35 PST 2008


On Wed, Dec 24, 2008 at 7:29 AM, Ted Kremenek <kremenek at apple.com> wrote:

> Part of the problem is that "Deserialize.cpp" (in llvm) uses
> GetCurrentBitNo() in a whole bunch of places.  AST
> serialization/deserialization is the only client of the serialization
> library, and there aren't that many test cases in the clang test suite for
> AST serialization because it just hasn't been completed yet.  I have a
> feeling that changing the behavior of GetCurrentBitNo() will break things.
>
> I'm actually a little surprised that GetCurrentBitNo() needs to be changed.
>  While the AST serialization work is incomplete, it has worked for
> non-trivial cases.  Since it uses GetCurrentBitNo() to jump around the
> bitcode file, I'm suspicious that anything needs to be changed.
>
> Also, what happens if NextChar == FirstChar?  Wouldn't
> (NextChar-FirstChar-4)*8 be a negative number?
>

It will be negative. But in that case,  BitsInCurWord will be 0, the final
result is 0.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20081224/55259482/attachment.html>


More information about the cfe-dev mailing list