Option Strict On
Public Module SignBit
Public Sub Main()
Dim negValue As Integer = -1024
' Save state of sign bit
Dim signBit As Integer = negValue And &H80000000
negValue = negValue << 2
' Clear sign bit
negValue = negValue And &H7FFFFFFF
' Restore sign bit
negValue = negValue Or signBit
Console.WriteLine("Value after shift operation: {0}", negValue)
End Sub
End Module
Value after shift operation: -4096