How can I implement a two’s complement in VB.NET using unsigned integer types such as Byte, UShort, UInteger and ULong? Can I cast a UInteger to an Integer?
How can I implement a two’s complement in VB.NET using unsigned integer types such
Share
No, you can’t cast. That will result in an overflow exception for large values.
You can, however, do this:
But what stops you from doing the math with the unsigned values without casting them to something? It just works.