Sam

Sam

  • NA
  • 166
  • 0

C# Logical operation

Dec 23 2011 10:46 AM

Hi,
I have an  array double[] MyArray (32 bits) and a variable ushort MyDevice (16 bits).

I wish to load the ushort MyDevice 16 bits to the upper 16 bits of the double[] MyArray
without affecting the lower array bits, but I get casting errors.
(Both work  in C++) but not in C# (it's too safe!).

Have tried:

MyArray[1]  |=  MyDevice << 16;

and

MyArray[1] & 0xFFFF0000 = MyDevice;

I get errors in both cases.

Can anyone advice?

Thanks

Answers (7)