I can cast a ubyte to a byte, but as far as I know I'd only get positive values out of that conversion.
ubyte b = 255; byte b2 = cast(byte) b; assert(b2 == -1);
No information is lost by that cast, all the bits remain exactly the same.
Adam D. Ruppe via Digitalmars-d-learn Sun, 16 Aug 2015 05:00:46 -0700
I can cast a ubyte to a byte, but as far as I know I'd only get positive values out of that conversion.
ubyte b = 255; byte b2 = cast(byte) b; assert(b2 == -1);
No information is lost by that cast, all the bits remain exactly the same.