function decodeBlockTypeAndLength(s, treeType, numBlockTypes) {
    let /** @type{!Int32Array} */ ringBuffers = s.rings;
    let /** @type{number} */ offset = 4 + treeType * 2;
    if (s.bitOffset >= 16) {
      s.accumulator32 = (s.shortBuffer[s.halfOffset++] << 16) | (s.accumulator32 >>> 16);
      s.bitOffset -= 16;
    }
    let /** @type{number} */ blockType = readSymbol(s.blockTrees, 2 * treeType, s);
    let /** @type{number} */ result = readBlockLength(s.blockTrees, 2 * treeType + 1, s);
    if (blockType == 1) {
      blockType = ringBuffers[offset + 1] + 1;
    } else if (blockType == 0) {
      blockType = ringBuffers[offset];
    } else {
      blockType -= 2;
    }
    if (blockType >= numBlockTypes) {
      blockType -= numBlockTypes;
    }
    ringBuffers[offset] = ringBuffers[offset + 1];
    ringBuffers[offset + 1] = blockType;
    return result;
  }
@param {!State} s
@param {number} treeType
@param {number} numBlockTypes
@return {number}