Ah, I used 8000 000 as specified in the question and then the results are both correct and identical...but as you say - if you use 8 000 000 0 then the formula node seems to have a problem...
Not a fix to the formula node...but do you have to do that calculation in a formula node? If you have a lot of other calculations that makes it nice to use a formula node instead of pure G you could bypass the problem by doing the AND graphically either prior to the formula node or split the node into two nodes and do it in pure G between the two nodes...
Francesco Pezzuti wrote in news:b5v7u0$3pm2$1@ID- 11723.news.dfncis.de:
> Hi, > > In may app I need to operate a bit AND operation > with a large mask (32 bit wise) in formula node. > > If I use a mask that use the last bit (e.g. 0x8000000) > the operation return a wrong value, as the last bit > is used as a bit sign. > > I have also specified the representation of the output > variable as U32 without success: > > ------- > uInt32 c; > c = a & b; > ------- > > a = 0x8000000 > b = 0x8000000 > c -> 0x7FFFFFFF > > Instead I use a "normal" AND function (the graphical) > I get out a correct value of 0x80000000. > > Seems that the implementation is not the same.....
It seems that the implementation of unsigned int in the formula node is
completely wrong.
Have tried to use a signed int. For bit fiddling this is the same as unsigned int. If you have or need a unsigned int outside the formula node then use the conversion functions to get the inputs/outputs right.
(From my reading of your posting it seems that you have evaluated the use of signed int, and it may be that you do more with the number than just bit fiddling, but i can't tell without more information)