src/cpu/pred/tage_base.cc
// Up-down unsigned saturating counter
Up-down unsigned saturating counter
Up - down unsigned saturating counter
void
TAGEBase::unsignedCtrUpdate(uint8_t & ctr, bool up, unsigned nbits)
{
    assert(nbits <= sizeof(uint8_t) << 3);
    if (up) {
        if (ctr < ((1 << nbits) - 1))
            ctr++;
    } else {
        if (ctr)
            ctr--;
    }
}
void TAGEBase :: unsignedCtrUpdate ( uint8_t & ctr , bool up , unsigned nbits ) { assert ( nbits <= sizeof ( uint8_t ) << 3 ) ; if ( up ) { if ( ctr < ( ( 1 << nbits ) - 1 ) ) ctr ++ ; } else { if ( ctr ) ctr -- ; } }
Up-down unsigned saturating counter
Up - down unsigned saturating counter