On 26/10/2012, at 4:04 AM, Tim Margheim wrote:

> On 10/24/2012 3:59 PM, john skaller wrote:
>> On 25/10/2012, at 2:35 AM, Tim Margheim wrote:
>>> Thanks.  John's answer fixes the crashing loop.  I still have the access 
>>> violation in 64-bit mode when populating the tree, though.
>> Repost your code with the fix.
>> Do you know which call causes the access violation, i.e. exactly where?
> I didn't repost it because I hadn't changed that code--the violation was 
> occurring in the first loop (which populates the tree), and I had only 
> changed the third loop.  It was a "Attempted to read or write protected 
> memory" error, and it was occurring somewhere in JudySLIns.
> 
> However, I fixed it!  (I got a hint from a compiler warning I'd missed.)  I 
> tracked it down to this in JudyPrivate.h:
> #define cJU_ALLONES  (~0UL)
> which I had to change to
> #define cJU_ALLONES  (~0ULL)
> 
> That fixed the access violation.

~(Word_t)0

would always work (assuming Word_t is defined).

Also plain old

        (Word_t)(-1)

would also work on 2-compilement machines (which is all of them these days).

> 
> It turns out that the Judy code uses some literal values with a UL suffix, 
> e.g. "0x100UL".  And in WIN64, that's only 32 bits--which can lead to 
> shenanigans, since the code expects it to be 64 bits when in 64-bit mode.  So 
> I need to do "0x100ULL", or perhaps "(Word_t)0x100".  Though a run-time 
> typecast would add some instructions (right?),

Compiler dependent, but generally it shouldn't: constant folding in
the compiler should handle it.

--
john skaller
[email protected]
http://felix-lang.org




------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_sfd2d_oct
_______________________________________________
Judy-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/judy-devel

Reply via email to