docs: static DirectCompactUnorderedSketch compact(final UpdateSketch sketch,
        final WritableMemory dstMem) {
      final int curCount = sketch.getRetainedEntries(true);
      long thetaLong = sketch.getThetaLong();
      boolean empty = sketch.isEmpty();
      thetaLong = thetaOnCompact(empty, curCount, thetaLong);
      empty = emptyOnCompact(curCount, thetaLong);
      final int preLongs = computeCompactPreLongs(thetaLong, empty, curCount);
      final short seedHash = sketch.getSeedHash();
      final long[] cache = sketch.getCache();
      final int requiredFlags = READ_ONLY_FLAG_MASK | COMPACT_FLAG_MASK;
      final byte flags = (byte) (requiredFlags | (empty ? EMPTY_FLAG_MASK : 0));
      final boolean ordered = false;
      final long[] compactCache = CompactSketch.compactCache(cache, curCount, thetaLong, ordered);
      loadCompactMemory(compactCache, seedHash, curCount, thetaLong, dstMem, flags, preLongs);
      return new DirectCompactUnorderedSketch(dstMem);
    }