I am looking for the C# or C++ equivalent of the following VFP snippet...

someVar = bitor(bitor(bitlshift(3, 13), bitlshift(4, 9)), 0x00000001)

Thanks in advance.

Re: C# or C++ equivalent of VFP (Visual Fox Pro) BITOR by Olaf

Olaf
Sat Feb 11 14:11:48 CST 2006

someVar = 26625;

Well, bit wise manipulaions are operators in C:

bitlshift: <<
bitrshift: >>
bitor:|
bitand: &
bitxor: ^

And that's still valid in C++ and C#.

Bye, Olaf.





Re: C# or C++ equivalent of VFP (Visual Fox Pro) BITOR by LvBohemian

LvBohemian
Sat Feb 11 17:29:27 CST 2006

I guess I am missing something...

this in vfp...
someVar = bitor(bitor(bitlshift(3, 13), bitlshift(4, 9)), 0x00000001)

does not appear to translate to...
someVar = |(|(<<(3, 13), <<(4, 9)), 0x00000001)

thanks in advance.



Re: C# or C++ equivalent of VFP (Visual Fox Pro) BITOR by Olaf

Olaf
Sun Feb 12 03:38:26 CST 2006

Hi LvBohemian

>I guess I am missing something...
...
> does not appear to translate to...
> someVar = |(|(<<(3, 13), <<(4, 9)), 0x00000001)

Yes, you are missing that operators work different than functions:

function: function(operand1,operand2)
operator: operand1 operator operand2
Depending on the definition of the function it could sometimes also
translate to the different order of operands:
operator: operand2 operator operand1

for example:
function bitor: bitor(1,2)
operator |: 1|2

+ is an operator you should know, you also don't write +(1,2)
you write 1+2, don't you?

Well, pps showed you.

I thought that hint would be sufficient. As you should have a help
system with c++, c# you could find the rest yourself, with the
help or with google.

Bye, Olaf.