Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: a stupid doubt with the ^

Author: Robert Hyatt

Date: 20:46:38 05/16/00

Go up one level in this thread


On May 16, 2000 at 22:56:00, Antonio Dieguez wrote:

>On May 16, 2000 at 22:33:41, Bruce Moreland wrote:
>
>>On May 16, 2000 at 22:14:49, Antonio Dieguez wrote:
>>
>>>hello, at last im really implementing hash tables, and they are already working
>>>on my program, more or less.
>>>
>>>I have a doubt about the ^, am sorry my complete ignorance but what kind of
>>>numbers appears? for example two numbers of 7 digits sometimes results on a
>>>number of 8 digits! and off course this cant be out of control if it is the
>>>index for the hash table.
>>>
>>>Thanks in advance...
>>>
>>>bye bye............. be well.
>>>
>>>me.
>>
>>^ is XOR.  If you say A ^ B, you get zeros in every bit position except where
>>there was a one-bit in A and a zero-bit in B, or vice versa.
>>
>>1 ^ 1 = 0
>>1 ^ 0 = 1
>>0 ^ 1 = 1
>>0 ^ 0 = 0
>>
>>There is no carrying, so if you have two numbers A and B, A ^ B can't be more
>>than A | B.  You can't XOR two 7-bit numbers and get a number that's 8-bits.
>>
>>bruce
>
>hi
>
>i mean for example 8607879^4567890=13036501
>
>so here 7digits^7digits=8digits
>
>am sorry if there is something obvius i still dont get clear...
>
>me.


Convert em both to binary.  Then do the xor.  You will have no more bits set
than in the longer of the two binary numbers.  And you may have less than
either, given the right number of 1 bits in the right places.  IE if both are
all 1 bits, you get a result of zero (0).



This page took 0 seconds to execute

Last modified: Thu, 15 Apr 21 08:11:13 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.