Results 1 to 4 of 4

Thread: Bit masking problem

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    May 2002
    Posts
    142

    Bit masking problem

    I am trying to bit mask the first 6 bits of a byte (8 bits) so the binary looks like 00000011 which I think is &3 ( in hex).

    It says here that you just use the AND operator and then the hex.
    I am using this:
    Dim VPCuff1 As Integer = (buffer(2) and &3) * 256 + buffer(3)

    buffer() is a byte array (0-15 bytes). I get an error on the: &3 (hex part). When I use something like &HFF00 it doesn't give me an error.

    Any thoughts???
    Bebandit

  2. #2
    I wonder how many charact
    Join Date
    Feb 2001
    Location
    Savage, MN, USA
    Posts
    3,704
    I don't think &3 is valid... perhaps &H3. ???

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    May 2002
    Posts
    142

    thanks

    That reduces the error!!
    Thanks!!

    But what does H value stand for?
    (How the hex should I know?)))


  4. #4
    I wonder how many charact
    Join Date
    Feb 2001
    Location
    Savage, MN, USA
    Posts
    3,704
    Not sure really, all I know is evertime i convert from C# to VB, I have to change the 0x..... to &H.... so I guessed. It may not even be the correct value you were looking for lol...

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