[vtk-developers] Who knows vtksqlite/vtk_sqlite3.c ?

David Cole david.cole at kitware.com
Fri Apr 8 19:30:14 EDT 2011


On Fri, Apr 8, 2011 at 6:29 PM, Sean McBride <sean at rogue-research.com>wrote:

> Hi all,
>
> One of the few remaining warnings building VTK with clang is:
>
>
> /VTK/Utilities/vtksqlite/vtk_sqlite3.c:19158:15: warning: shift result
> (8321499136) requires 34 bits to represent, but 'int' only has 32 bits [-
> Wshift-overflow]
>    a &= (0x1f<<28)|(0x7f<<14)|(0x7f);
>          ~~~~^ ~~
>
> The warning seems quite correct.  The code's intent is incomprehensible
> however. :)  Anyone an expert in vtksqlite/vtk_sqlite3.c ?
>


Not an expert, but I used google to find the canonical source for SQLite.
:-)

The line in the HEAD of the sqlite code appears to look like this:

    a &= SLOT_4_2_0;

And SLOT_4_2_0 is defined as:

  #define SLOT_4_2_0   0xf01fc07f

With a later assertion:

  assert( SLOT_4_2_0 == ((0xfU<<28) | (0x7f<<14) | (0x7f)) );

Whether we can take a one-line fix and simply apply...

  (0xfU<<28) | (0x7f<<14) | (0x7f)

... to eliminate our warning, I do not know. But these are the facts. That
code is pretty hard to understand why they're doing what they're doing...
it's a bit bit-shifty...

I am comparing to Sqlite HEAD as of right now, from:

  http://www.sqlite.org/cgi/src/info/543f75a6ab

The code in question maps to their "src/util.c" file. (Found with a grep for
"0x7f<<14" ...)

  :-P


Have a good weekend.
David C.




> Cheers,
>
> --
> ____________________________________________________________
> Sean McBride, B. Eng                 sean at rogue-research.com
> Rogue Research                        www.rogue-research.com
> Mac Software Developer              Montréal, Québec, Canada
>
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtk-developers
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtk-developers/attachments/20110408/5a3165d5/attachment.html>


More information about the vtk-developers mailing list