buildMiniblock :: Miniblock -> Builder
buildMiniblock (Miniblock bs) =
    let compressionBitIndex = 31
        compressedBlock = compressByteStringFixed ((BS.length bs)-1) bs
        blockToWrite = case compressedBlock of
          Nothing -> bs
          Just x  -> x
        size = BS.length blockToWrite
        writtenSize = if isJust compressedBlock
                      then size
                      else setBit size compressionBitIndex
    in mconcat [
            fromWord32le $ fromIntegral writtenSize,
            fromByteString blockToWrite
           ]
buildMiniblock :: Miniblock -> Builder
buildMiniblock (Miniblock bs) =
    let compressionBitIndex = 31
        compressedBlock = compressByteStringFixed ((BS.length bs)-1) bs
        blockToWrite = case compressedBlock of
          Nothing -> bs
          Just x  -> x
        size = BS.length blockToWrite
        writtenSize = if isJust compressedBlock
                      then size
                      else setBit size compressionBitIndex
    in mconcat [
            fromWord32le $ fromIntegral writtenSize,
            fromByteString blockToWrite
           ]
buildMiniblock (Miniblock bs) =
    let compressionBitIndex = 31
        compressedBlock = compressByteStringFixed ((BS.length bs)-1) bs
        blockToWrite = case compressedBlock of
          Nothing -> bs
          Just x  -> x
        size = BS.length blockToWrite
        writtenSize = if isJust compressedBlock
                      then size
                      else setBit size compressionBitIndex
    in mconcat [
            fromWord32le $ fromIntegral writtenSize,
            fromByteString blockToWrite
           ]