static final void hipAndKxQIncrementalUpdate ( final AbstractHllArray host , final int oldValue , final int newValue ) { assert newValue > oldValue ; final int configK = 1 << host . getLgConfigK ( ) ; //update hipAccum BEFORE updating kxq0 and kxq1 double kxq0 = host . getKxQ0 ( ) ; double kxq1 = host . getKxQ1 ( ) ; host . addToHipAccum ( configK / ( kxq0 + kxq1 ) ) ; //update kxq0 and kxq1; subtract first, then add. if ( oldValue < 32 ) { host . putKxQ0 ( kxq0 -= invPow2 ( oldValue ) ) ; } else { host . putKxQ1 ( kxq1 -= invPow2 ( oldValue ) ) ; } if ( newValue < 32 ) { host . putKxQ0 ( kxq0 += invPow2 ( newValue ) ) ; } else { host . putKxQ1 ( kxq1 += invPow2 ( newValue ) ) ; } }
Called here and by Heap and Direct 6 and 8 bit implementations