Why are you assigning the
Int64
to a
double
?
Cast the second operand
ck
to
Int64
instead and perform the operation:
Int64 num_add64 =Int64.Parse(add64, System.Globalization.NumberStyles.HexNumber);
int r = Convert.ToInt32(num_add64 & Convert.ToInt64(ck));
Because you are dealing with integers of different width and performing an
AND
operation, you should check if using
uint
might be a better choice here (assuming
ck
is an
uint
):
UInt64 num_add64 =UInt64.Parse(add64, System.Globalization.NumberStyles.HexNumber);
uint r = Convert.ToUInt32(num_add64) & ck;