private void srcMemoryToCombinedBuffer ( final Memory srcMem , final int serVer , final boolean srcIsCompact , final int combBufCap ) { final int preLongs = 2 ; final int extra = ( serVer == 1 ) ? 3 : 2 ; // space for min and max values, buf alloc (SerVer 1) final int preBytes = ( preLongs + extra ) << 3 ; final int bbCnt = baseBufferCount_ ; final int k = getK ( ) ; final long n = getN ( ) ; final double [ ] combinedBuffer = new double [ combBufCap ] ; //always non-compact //Load min, max putMinValue ( srcMem . getDouble ( MIN_DOUBLE ) ) ; putMaxValue ( srcMem . getDouble ( MAX_DOUBLE ) ) ; if ( srcIsCompact ) { //Load base buffer srcMem . getDoubleArray ( preBytes , combinedBuffer , 0 , bbCnt ) ; //Load levels from compact srcMem long bitPattern = bitPattern_ ; if ( bitPattern != 0 ) { long memOffset = preBytes + ( bbCnt << 3 ) ; int combBufOffset = 2 * k ; while ( bitPattern != 0L ) { if ( ( bitPattern & 1L ) > 0L ) { srcMem . getDoubleArray ( memOffset , combinedBuffer , combBufOffset , k ) ; memOffset += ( k << 3 ) ; //bytes, increment compactly } combBufOffset += k ; //doubles, increment every level bitPattern >>>= 1 ; } } } else { //srcMem not compact final int levels = Util . computeNumLevelsNeeded ( k , n ) ; final int totItems = ( levels == 0 ) ? bbCnt : ( 2 + levels ) * k ; srcMem . getDoubleArray ( preBytes , combinedBuffer , 0 , totItems ) ; } putCombinedBuffer ( combinedBuffer ) ; }
Loads the Combined Buffer min and max from the given source Memory . The resulting Combined Buffer is always in non - compact form and must be pre - allocated .