Results 1 to 4 of 4

Thread: exclusive OR of two integers

  1. #1
    louislau
    Guest

    Question exclusive OR of two integers

    Is there any direct way to exclusive OR two integers in VB?

    My method is to convert the integers to strings of their binary presentations, and then exclusive OR it character by character

    It seems silly. Any fast and direct method of doing this? Thanks

  2. #2
    Fanatic Member Kaverin's Avatar
    Join Date
    Oct 2000
    Posts
    930
    You could use this:
    VB Code:
    1. Dim x As Integer, A As Integer, B As Integer
    2. A = 10      '00001010
    3. B = 24      '00011000
    4. x = A Xor B '00010010
    I'm baaaack...
    VB5 Professional Edition, VC++ 6
    Using a 1 gHz Thunderbird, 256 mb RAM, 40 gb HD system with Win98se

    I feel special because I finally figured out how to loop midis: Post link
    I'm a fanatic too

  3. #3
    louislau
    Guest

    Smile

    Thanks a lot!

  4. #4
    Aurilus
    Guest
    AFAIK, the OR, XOR, etc. functions perform their operations a bitwise comparison between two numbers / bytes.

    - Aurilus

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