Results 1 to 2 of 2

Thread: Hex And Bitmasking question

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    May 2002
    Posts
    142

    Hex And Bitmasking question

    For some strange reason, I get 16 for jack2. I am bitmasking the integer using the hex &HFC (11111100) which would give me the binary 00 which is zero.


    <code>
    Dim byteit(2) As Byte
    Dim jack1 As Integer
    Dim jack2 As Integer
    Dim jack3 As Integer

    byteit(0) = 16
    byteit(1) = 32
    jack1 = byteit(0) >> 2 ' returns 4 which is correct
    jack2 = (byteit(0) And &HFC)
    jack3 = jack2 + byteit(1) 'ocuff
    TextBox4.Text = jack1 & " " & jack2 & " " & jack3


    </code>

    returns: 4 16 48

    Any thoughts???

  2. #2

    Thread Starter
    Addicted Member
    Join Date
    May 2002
    Posts
    142

    OK I got it...

    I used the opposite hex code. Instead of HFC (11111100), I needed to use the opposite H0c or just HC (00000011).

    Thanks for all the responses!!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width