+/*
+ * Retrieve a list of matches with the current position.
+ *
+ * @mf
+ * The matchfinder structure.
+ * @in_begin
+ * Pointer to the beginning of the input buffer.
+ * @cur_pos
+ * The current position in the input buffer (the position of the sequence
+ * being matched against).
+ * @max_len
+ * The maximum permissible match length at this position.
+ * @nice_len
+ * Stop searching if a match of at least this length is found.
+ * Must be <= @max_len.
+ * @max_search_depth
+ * Limit on the number of potential matches to consider. Must be >= 1.
+ * @next_hash
+ * Pointer to the hash code for the current sequence, which was computed
+ * one position in advance so that the binary tree root could be
+ * prefetched. This is an input/output parameter.
+ * @best_len_ret
+ * If a match of length >= 3 was found, then the length of the longest such
+ * match is written here; otherwise 2 is written here. (Note: this is
+ * redundant with the 'struct lz_match' array, but this is easier for the
+ * compiler to optimize when inlined and the caller immediately does a
+ * check against 'best_len'.)
+ * @lz_matchptr
+ * An array in which this function will record the matches. The recorded
+ * matches will be sorted by strictly increasing length and increasing
+ * offset. The maximum number of matches that may be found is
+ * 'min(nice_len, max_len) - 2 + 1', or one less if length 2 matches are
+ * disabled.
+ *
+ * The return value is a pointer to the next available slot in the @lz_matchptr
+ * array. (If no matches were found, this will be the same as @lz_matchptr.)
+ */
+static inline struct lz_match *
+TEMPLATED(bt_matchfinder_get_matches)(struct TEMPLATED(bt_matchfinder) *mf,
+ const u8 *in_begin,
+ ptrdiff_t cur_pos,
+ u32 max_len,
+ u32 nice_len,
+ u32 max_search_depth,
+ u32 *next_hash,
+ u32 *best_len_ret,
+ struct lz_match *lz_matchptr)
+{
+ return TEMPLATED(bt_matchfinder_advance_one_byte)(mf,
+ in_begin,
+ cur_pos,
+ max_len,
+ nice_len,
+ max_search_depth,
+ next_hash,
+ best_len_ret,
+ lz_matchptr,
+ true);
+}
+