ulaho
Registered Member
- Aug 4, 2013
- 76
- 27
I have a function like this which would work in python:
xtime = lambda a: (((a << 1) ^ 0x1B) & 0xFF) if (a & 0x80) else (a << 1)
How to implement same idea in c# ?
I get errors, if I write this like that:
int xtime(int x)
{
if (x & 0x80)
{
return (((x << 1) ^ 0x1B) & 0xFF);
}
return x << 1;
}
Can some help with this xtime implementation?
xtime = lambda a: (((a << 1) ^ 0x1B) & 0xFF) if (a & 0x80) else (a << 1)
How to implement same idea in c# ?
I get errors, if I write this like that:
int xtime(int x)
{
if (x & 0x80)
{
return (((x << 1) ^ 0x1B) & 0xFF);
}
return x << 1;
}
Can some help with this xtime implementation?