- #1
hadi amiri 4
- 98
- 1
C# vs c !
Hello every body!
can anyone explain what this c# code does or give a C equalivent?
public static void Replace(ref byte b, int pos,
byte value)
{
b = (byte) (value == 1 ? b | (1 << pos)
: b & ~(1 << pos));
}
public static byte Extract(byte b, int pos) {
return (byte) ((b & (1 << pos)) >> pos);
}
Hello every body!
can anyone explain what this c# code does or give a C equalivent?
public static void Replace(ref byte b, int pos,
byte value)
{
b = (byte) (value == 1 ? b | (1 << pos)
: b & ~(1 << pos));
}
public static byte Extract(byte b, int pos) {
return (byte) ((b & (1 << pos)) >> pos);
}