Home > Net >  Basic operators
Basic operators

Time:02-06

Int x=0 XFF, y;
Y=x & gt;> 4.
Or
Int x=0 x3, y;
Y=x & amp; 0 x1;

Above type int or uint types can, change other type is not? Why???????

CodePudding user response:

The underlying encapsulation just encapsulates the int and long types, other don't have to be, the building Lord what want to achieve?

CodePudding user response:

You see error message bai,

4
0 x1
These constants are what kind of?

CodePudding user response:

I'd like to exchange a ushort variables of type of bytes

Now can only be transformed to
Public int H_L (short a)//high and low byte conversion
{
Int I=the Convert. ToInt32 (a);
Int high and low;
High=(I & amp; 0 xf0) & gt;> 4.
Low=(I & amp; 0 xf) & lt; <4.
The return on | low;
}

CodePudding user response:

Short a=0 x56;
Short b=(short) ((a & amp; 0 xf0) & gt;> 4 | (a & amp; 0 xf) & lt; <4);
Try it, in fact also no difference

CodePudding user response:

Byte is also ok
  •  Tags:  
  • C#
  • Related