I am trying to use the <<
operator on a long
, like so:
((long) num3) << ( 2 + (long) num4)))
This gives me the following error:
Operator << cannot be applied to operands of type long and long.
If I don't cast num4
to a long
, there is no error. However, I cannot keep it as an int
. Is there any other way around this?
The right operand has to be an int
, not a long
. It wouldn't make sense to use a long
as the number of bits to shift, since integral types in C# never have more than 64 bits.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With