unit test not passing on my computer

Lukasz Zalewski lukas at dcs.qmul.ac.uk
Tue Jun 22 02:15:52 MDT 2010


Hi Matthias,

On 22/06/2010 07:26, Matthias Dieter Wallnöfer wrote:
> Hi Lukasz,
>
> if grouptype is not None:
>
> - ldbmessage["groupType"] = "%d" % ((grouptype)-2**32)
>
> + ldbmessage["groupType"] = "%d" % ((grouptype + 2**31) % 2**32 - 2**31
>
> ^^^ isn't this "groupType" alignment easier to do? Shouldn't "groupType
> % 2**32" alone fit ?
just using
"%d" % ((grouptype) % 2**32)
seems to break on both 32 and 64bit:
On 32:
groupType= -2147483644
groupType (grouptype % 2**32)= 2147483652

on 64bit:
groupType= 2147483652
groupType (grouptype % 2**32)= 2147483652

Note: on 32bit the value is correct to start with so no conversion would 
be necessary

Maybe Jelmer can shed some light on this

Luk
>
> Matthias
>
> Lukasz Zalewski wrote:
>> Matthieu,
>> Attached is the patch that fixes the problems when assigning
>> (converting) grouptype value on 64 and 32 bit architectures. I have
>> tested this on both architectures and both produce exactly the same
>> values. Please let me know if this works for you
>>
>> Luk
>



More information about the samba-technical mailing list