```
Dim inputByte As Byte = Bit.ParseInt("11010111", 2)
Dim inputShort As Short = Bit.ParseInt("1101011111010111", 2)
Dim inputInt As Int = Bit.ParseInt("11010111110101111101011111010111", 2)
'NOTE: The above bomb's out. Looks like we cannot set the complete 32 bits of an Int
Dim inputInt As Int = 0xD7D7D7D7
Log(inputByte)
Log(inputShort)
Log(inputInt)
Dim byteShiftAmount As Int = 5
Dim shortShiftAmount As Int = 13
Dim intShiftAmount As Int = 29
'Determine overflow bits from a left shift. Just do a right shift!
Log("Left shifting:")
Log("Byte:")
Dim overFlowByte As Byte = Bit.ShiftRight(Bit.And(inputByte, 0xFF), 8 - byteShiftAmount)
Log($"overflow for ${inputByte} shifted ${byteShiftAmount} to the left = ${overFlowByte}"$)
Log($"overflow for ${Bit.ToBinaryString(Bit.And(inputByte, 0xFF))} shifted ${byteShiftAmount} to the left = ${Bit.ToBinaryString(Bit.And(overFlowByte, 0xFF))}"$)
Log("Short:")
Dim overFlowShort As Short = Bit.ShiftRight(Bit.And(inputShort, 0xFFFF), 16 - shortShiftAmount)
Log($"overflow for ${inputShort} shifted ${shortShiftAmount} to the left = ${overFlowShort}"$)
Log($"overflow for ${Bit.ToBinaryString(Bit.And(inputShort, 0xFFFF))} shifted ${shortShiftAmount} to the left = ${Bit.ToBinaryString(Bit.And(overFlowShort, 0xFFFF))}"$)
Log("Int:")
Dim overFlowInt As Int = Bit.UnsignedShiftRight(inputInt, 32 - intShiftAmount)
Log($"overflow for ${inputInt} shifted ${intShiftAmount} to the left = ${overFlowInt}"$)
Log($"overflow for ${Bit.ToBinaryString(inputInt)} shifted ${intShiftAmount} to the left = ${Bit.ToBinaryString(overFlowInt)}"$)
'Determine overflow from a right shift. Do it by creating a mask ((1 << shiftAmount) - 1) and ANDing it with the original value
Log("Right shifting:")
Log("Byte:")
overFlowByte = Bit.And(Bit.And(inputByte, 0xFF), Bit.ShiftLeft(1, byteShiftAmount) - 1)
Log($"overflow for ${inputByte} shifted ${byteShiftAmount} to the right = ${overFlowByte}"$)
Log($"overflow for ${Bit.ToBinaryString(Bit.And(inputByte, 0xFF))} shifted ${byteShiftAmount} to the right = ${Bit.ToBinaryString(Bit.And(overFlowByte, 0xFF))}"$)
Log("Short:")
overFlowShort = Bit.And(Bit.And(inputShort, 0xFFFF), Bit.ShiftLeft(1, shortShiftAmount) - 1)
Log($"overflow for Short ${inputShort} shifted ${shortShiftAmount} to the right = ${overFlowShort}"$)
Log($"overflow for Short ${Bit.ToBinaryString(Bit.And(inputShort, 0xFFFF))} shifted ${shortShiftAmount} to the right = ${Bit.ToBinaryString(Bit.And(overFlowShort, 0xFFFF))}"$)
Log("Int:")
Dim overFlowInt As Int = Bit.And(inputInt, Bit.ShiftLeft(1, intShiftAmount) - 1)
Log($"overflow for Int ${inputInt} shifted ${intShiftAmount} to the right = ${overFlowInt}"$)
Log($"overflow for Int ${Bit.ToBinaryString(inputInt)} shifted ${shortShiftAmount} to the right = ${Bit.ToBinaryString(overFlowInt)}"$)vvv
```