cgminer icon indicating copy to clipboard operation
cgminer copied to clipboard

Fixing if condition bug!

Open chipjarred opened this issue 4 years ago • 0 comments

In driver-gekko.c, the right side of an || expression always evaluated to false because it was testing that the same byte is simultaneously equal to four different values, which is logically impossible without being volatile (and if even if it were volatile it would almost certainly still be a bug).

Instead, I believe the intention was to work like the left-hand expression, which tests four consecutive bytes. I've changed it to do that.

So I changed it from this

case MINER_OPEN_CORE:
    if ((info->rx[0] == 0x72 && info->rx[1] == 0x03 && info->rx[2] == 0xEA && info->rx[3] == 0x83) ||
        (info->rx[0] == 0xE1 && info->rx[0] == 0x6B && info->rx[0] == 0xF8 && info->rx[0] == 0x09)) {
        //open core nonces = healthy chips.
        info->zero_check++;
    }
    break;

to this

case MINER_OPEN_CORE:
    if ((info->rx[0] == 0x72 && info->rx[1] == 0x03 && info->rx[2] == 0xEA && info->rx[3] == 0x83) ||
        (info->rx[0] == 0xE1 && info->rx[1] == 0x6B && info->rx[2] == 0xF8 && info->rx[3] == 0x09)) {
        //open core nonces = healthy chips.
        info->zero_check++;
    }
    break;

chipjarred avatar May 10 '21 01:05 chipjarred