Solidity has two different truncation rules depending on type: uint types trim from the right (keeping least significant bits), while bytes types trim from the left (keeping most significant bits). This means the order of casting operations matters enormously. A chain like bytes32 → uint256 → uint32 trims from the right, while

Sort: