long allocate ( ) { if ( elemSize == 0 ) { return toHandle ( 0 ) ; } if ( numAvail == 0 || ! doNotDestroy ) { return - 1 ; } final int bitmapIdx = getNextAvail ( ) ; int q = bitmapIdx >>> 6 ; int r = bitmapIdx & 63 ; assert ( bitmap [ q ] >>> r & 1 ) == 0 ; bitmap [ q ] |= 1L << r ; if ( -- numAvail == 0 ) { removeFromPool ( ) ; } return toHandle ( bitmapIdx ) ; }
Returns the bitmap index of the subpage allocation .