countMatch

private fnsize_t countMatch(const(ubyte)[] src, size_t pos1, size_t pos2, size_t maxLen)

Count the number of matching bytes starting at two positions.

Compares bytes starting at pos1 and pos2 within src and returns the count of consecutive matching bytes, up to maxLen.

Parameters

srcThe input buffer to search within.
pos1First position to compare from.
pos2Second position to compare from.
maxLenMaximum number of bytes to compare.

Returns

The number of consecutive matching bytes (0 to maxLen).
private fnsize_t countMatch(const(ubyte) * srcPtr, size_t srcLen, size_t pos1, size_t pos2, size_t maxLen) nothrow @nogc

Pointer-based variant of countMatch for use from @system/@trusted contexts where the source pointer and length are already available.

Parameters

srcPtrPointer to the start of source data.
srcLenTotal length of the source buffer.
pos1First position to compare from.
pos2Second position to compare from.
maxLenMaximum number of bytes to compare.

Returns

The number of consecutive matching bytes (0 to maxLen).