1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-11-26 23:52:26 +00:00

Fix ASL overflow test.

This commit is contained in:
Thomas Harte 2022-10-18 22:43:17 -04:00
parent d09473b66f
commit 979bf42541

View File

@ -359,7 +359,9 @@ template <Operation operation, typename IntT, typename FlowController> void shif
} else { } else {
// For a shift of n places, overflow will be set if the top n bits were not // For a shift of n places, overflow will be set if the top n bits were not
// all the same value. // all the same value.
const auto affected_bits = IntT(~0 << shift); const auto affected_bits = IntT(
~((top_bit<IntT>() >> shift) - 1)
);
status.overflow_flag = (destination & affected_bits) && (destination & affected_bits) != affected_bits; status.overflow_flag = (destination & affected_bits) && (destination & affected_bits) != affected_bits;
} }
} }