I have a version of Judy that has been modified to work correctly
on Windows. Unforunately I just found another bug, but I have no idea
at all what it is.

Judy doesn’t work on Windows 64 bit because it has “long” assumed
to be 64 bit which it isn’t. I fixed my copy of the code to replace code like

        -1L // all bits set

to

        -(intptr_t)1

which works on all platforms for both 32 and 64 bits.

However I have just found a bug in JudyLIns.

My code is also not in sync with the latest download from Sourceforge
which seens to be version 1.5, I have no idea what version I modified.
I spot at least one place where files differ.

Just for example this code in the repository is WRONG:

#define JU_LEASTBYTESMASK(BYTES) \
        ((0x100UL << (cJU_BITSPERBYTE * ((BYTES) - 1))) - 1)

Here is my version which is CORRECT:

#define JU_LEASTBYTESMASK(BYTES) \
        (((uintptr_t)0x100UL << (cJU_BITSPERBYTE * ((BYTES) - 1))) - 1)

Another example: WRONG in repository:


#define cJU_ALLONES  (~0UL)

CORRECT in my code:

#define cJU_ALLONES  (~(uintptr_t)0)

So here:


#define SEARCHLEAFNATIVE(LEAFTYPE,ADDR,POP1,INDEX)              \
    LEAFTYPE *P_leaf = (LEAFTYPE *)(ADDR);                      \
    LEAFTYPE I_ndex = (LEAFTYPE)INDEX; /* truncate hi bits */   \
    Word_t   l_ow   = cJU_ALLONES;                              \
    Word_t   m_id;                                              \
    Word_t   h_igh  = POP1;                                     \
                                                                \
    while ((h_igh - l_ow) > 1UL)       

the code will probably work, since we have integer promotion on the comparison.
Plain 1 would be good enough.

I basically modified things by getting rid of all “long” values and types.
Looks like I missed something. Its a bit hard to tell, so many macros
all over the place.

At present it looks grim: I will have to drop either Windows or Judy.
Or scrap my whole project.

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


------------------------------------------------------------------------------
Mobile security can be enabling, not merely restricting. Employees who
bring their own devices (BYOD) to work are irked by the imposition of MDM
restrictions. Mobile Device Manager Plus allows you to control only the
apps on BYO-devices by containerizing them, leaving personal data untouched!
https://ad.doubleclick.net/ddm/clk/304595813;131938128;j
_______________________________________________
Judy-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/judy-devel

Reply via email to