Operator '
&
' cannot be applied to operands of type 'ulong
' and'ulong*
'
What am I doing wrong? I'm trying to find which masks a integer consists of, if that makes sense.
e.g.
63 = 1+2+4+8+16+32
unsafe
{
UInt64 n = Convert.ToUInt64(textAttributes.Text);
UInt64* p = &n;
for(UInt64 i = 1; i <= n; i <<= 1)
{
if (i & p)
{
switch(i)
{
default:
break;
}
}
}
}
You dont need unsafe code for this.
The compiler error is legitimate since you apply the operator & between a pointer and an integer
You probably want :