Sign Bit : Bit « Data Type « VB.Net Tutorial






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








2.18.Bit
2.18.1.Bit Shift left and right
2.18.2.Sign Bit