XOR and XNOR operations with 2 or 3 inputs

If you're going to go there, maybe emulate the hardware cascade approach instead?

uint8_t  xor (uint8_t  *inputs, uint8_t  input_count) {
    
    uint8_t  i;         // Loop counter
    uint8_t  tmp;       // Running value  
    
    tmp = inputs[0];
    
    for (i = 1; i < input_count; i++) {
        tmp = (tmp != inputs[i]);
        if (tmp) return 1;
    }
    
    return 0;
}

uint8_t  xnor (uint8_t  *inputs, uint8_t  input_count) {
    
    uint8_t  i;         // Loop counter
    uint8_t  tmp;       // Running value  
    
    tmp = inputs[0];
    
    for (i = 1; i < input_count; i++) {
        tmp = (tmp == inputs[i]);
        if (!tmp) return 1;
    }
    
    return 0;
}

Would that do the trick? (Haven't tested it... might be overlooking an obvious snafu.) Not quite as fast as hard-coded conditionals, but scalable to the width of the counter... :slight_smile: