format/src/main/java/com/github/sadikovi/riff/Riff.java
/**
     * Select next power of 2 as buffer size.
     * @param conf configuration
     * @return validated bytes value
     */
Select next power of 2 as buffer size.
@param conf configuration
@return validated bytes value
Select next power of 2 as buffer size . @param conf configuration @return validated bytes value
static int power2BufferSize(Configuration conf) {
      int bytes = conf.getInt(BUFFER_SIZE, BUFFER_SIZE_DEFAULT);
      if (bytes > BUFFER_SIZE_MAX) return BUFFER_SIZE_MAX;
      if (bytes < BUFFER_SIZE_MIN) return BUFFER_SIZE_MIN;
      if ((bytes & (bytes - 1)) == 0) return bytes;
      bytes = Integer.highestOneBit(bytes) << 1;
      return (bytes < BUFFER_SIZE_MAX) ? bytes : BUFFER_SIZE_MAX;
    }
static int power2BufferSize ( Configuration conf ) { int bytes = conf . getInt ( BUFFER_SIZE , BUFFER_SIZE_DEFAULT ) ; if ( bytes > BUFFER_SIZE_MAX ) return BUFFER_SIZE_MAX ; if ( bytes < BUFFER_SIZE_MIN ) return BUFFER_SIZE_MIN ; if ( ( bytes & ( bytes - 1 ) ) == 0 ) return bytes ; bytes = Integer . highestOneBit ( bytes ) << 1 ; return ( bytes < BUFFER_SIZE_MAX ) ? bytes : BUFFER_SIZE_MAX ; }
Select next power of 2 as buffer size.
Select next power of 2 as buffer size .
// bytes is already power of 2