def getSum(a, b):
    """
    a XOR b is the sum
    a AND b is the carry
    If there is a nonzero carry, add the carry to the sum and shift the carry to the left. Repeat until the carry is zero.
    """
    sum = a ^ b
    carry = a & b
    
    while carry:
        sum ^= carry
        carry <<= 1
        
    return sum