Hello everyone!
This is with refrence to KB638.
In version 15.0.2, word-to-bit conversion is working fine, but In version 15.2, it's not working as expected.
Suppose, I have taken 3 bits with variables:- @Wordbit.Bit00, @Wordbit.Bit01, @Wordbit.Bit02 and having Register as @Wordbit.Register01
Then the Expressions are :- @Wordbit.Register01>>00, @Wordbit.Register01>>01, @Wordbit.Register01>>02
So, in this case,
If @Wordbit.Register01 value is 1 then Bit00 is value is 1
If @Wordbit.Register01 value is 2 then both Bit00 & Bit01 values are 1, in this case, only Bit01 should be 1
If @Wordbit.Register01 value is 4 then both Bit00, Bit01 & Bit02 values are 1, in this case, only Bit02 should be 1
This case is showing an error in version 15.2 and working fine in version 15.0.2
I am attaching the project file.
Hello,
This issue has already been reported (SPR 70191) and will be fixed in version 15.2.1 (already in Nightly Build if needed)
BR
Hello,
Assuming the proper PcVue version is used, expressions on a variable
@Wordbit.Register01>>00
@Wordbit.Register01>>01
...
will work fine with values up to 65535 (16 bits)
will work fine with values up to 2147483647 (31 bits).
But if I am not mistaken, not from 2147483648 to 4294967295 (32 bits)
I guess it is because of Long type (-2,147,483,648 to +2,147,483,647)
The workaround could be the following:
(@Wordbit.Register01 & (2 POW 00)) >> 00 [or of course (@Wordbit.Register01 & (2 POW 0)) >> 0]
(@Wordbit.Register01 & (2 POW 01)) >> 01
...
It will work fine for values up to ~48 bits
SPR 70191 has no effect on this syntax. Can be used in 15.2 at once.
Hi Edouard,
Apart from being a workaround to the SPR #70191, this trick is worth being described in a KB article. A title such as "How to do bit shifting with long integers".
Thanks
Thank you Benoît for this comment. It will be done soon.
I just would like to mention a new way to address requests regarding our KB, like new articles or mistakes report on old ones.
You can simply send an email to kb@arcinfo.odoo.com
Please provide the most possible details in the email.
It took time but finally we have something published: KB1150
Thank you Ludo.
Seeing the article content, don't you think we also need an SPR requesting the ability to extract all bits in 64-bit integers ?
Regards
I agree. The two other people who took part in the proofreading of the article made the same request (Gilles and Edouard). Never 2 without 3 as we often say. So I created the spr 71220 (my postal code).
This reminds me of the magnificent legend of Sissa who asked a reward for having invented the chess game, a grain of wheat on the first square of the chessboard, then 2 grains on the 2nd square, then to double the number on the following squares... Which was not possible, indeed the number is too big. https://en.wikipedia.org/wiki/Sissa_(mythical_brahmin)
The total number of grains can be shown to be 264-1 or 18,446,744,073,709,551,615 (eighteen quintillion, four hundred forty-six quadrillion, seven hundred forty-four trillion, seventy-three billion, seven hundred nine million, five hundred fifty-one thousand, six hundred and fifteen, over 1.4 trillion metric tons), which is over 2000 times the annual world production of wheat 🙂
https://en.wikipedia.org/wiki/Wheat_and_chessboard_problem


