On Mar 18, 2012 3:09 PM, "Manu" <[email protected]> wrote > int x = 123456; > x &= 0xFF; // x is now in range 0..255; now fits in a ubyte > ubyte y = x; // assign silently, cast can safely be implicit
This is related to Go's infinitely sized constants. If an expression produces a value out of range then brings it back in range in a constant it still works. int i = 1 << 100 >> 98; assert( i == 4); Not exactly related but similar idea.
