SCM

[#1011321] Wrong BitString value

View Trackers | Bugs | Download .csv | Monitor

Date:
2013-03-20 22:27
Priority:
3
State:
Closed
Submitted by:
Vladislav S (vmas)
Assigned to:
Jon Hanna (talliesin)
Npgsql Version:
2.0.12beta
Category:
None
Group:
None
Resolution:
Accepted
Summary:
Wrong BitString value

Detailed description
If value higher than 32 bits, e.g. for 33 bits, BitString contains 100000000000000000000000000000001 instead 111111111111111111111111111111111.

Followup

Message
Date: 2013-04-05 18:46
Sender: Vladislav S

Thank you, Jon, for your patch. It's wotk for me.
Date: 2013-04-05 13:13
Sender: Francisco Figueiredo jr.

This is now fixed in cvs. Jon also fixed another bug where BitString was rounding up to the nearest multiple of 32 the number of bits used to represent a value. So, for example, new BitString(true, 35) was using 64 bits and so when trying to compare it to others, or using ToString() it was returning a wrong value.

Thank you very much, Jon for your patch.

Please, those who were having problems, please, give it a try from cvs and let me know if it works ok for you.
Date: 2013-04-04 11:41
Sender: Jon Hanna

Couldn't get CVS working, so here's a patch based on the code on github. It was rather a silly bug, I must admit.

DO NOT apply the change suggested by yao cheng, it only fixes the behaviour in a very specific set of cases, and it introduces new bugs, such as:

new BitString(true, 127) == new BitString(new String('1', 127))

returning false, where it should clearly return true, and all the other comparison operators being similarly broken.
Date: 2013-04-03 16:58
Sender: Jon Hanna

I implemented that class, so I'll take a look. Hopefully tomorrow.
Date: 2013-03-22 13:55
Sender: yao cheng

Hi,vmas

I meet the same problem .I do some fixs in the BitString.cs class. I make line 91 from "_chunks.Add(0xFFFFFFFFu << - count);" TO " _chunks.Add(0xFFFFFFFFu);". After above change,the problem do not occur again.

you can take a try.

Attached Files:

Attachments:
bitString.patch

Changes:

Field Old Value Date By
status_idOpen2013-04-08 23:34fxjr
close_dateNone2013-04-08 23:34fxjr
File Added804: bitString.patch2013-04-04 11:41talliesin
ResolutionNone2013-04-04 11:31talliesin
assigned_tonone2013-04-03 16:58talliesin
Powered By FusionForge