Skip to content

Conversation

@ngxson
Copy link
Collaborator

@ngxson ngxson commented Nov 20, 2025

Ref: #17381 (comment)

  • Use uint64_t to align with the rest of the code base
  • Add reference to the original PR, so the comments have some context

@ngxson ngxson requested a review from ggerganov as a code owner November 20, 2025 16:33
@ngxson ngxson requested review from pwilkin and removed request for ggerganov November 20, 2025 16:33
Copy link
Collaborator

@pwilkin pwilkin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, my bad, should've used a system-independent data type to begin with (but see comment on condition).

throw std::runtime_error(std::string("expecting ',' at ") + pos);
}
if (min_times > MAX_REPETITION_THRESHOLD || (max_times != UINT64_MAX && max_times > MAX_REPETITION_THRESHOLD)) {
if (min_times > MAX_REPETITION_THRESHOLD || max_times > MAX_REPETITION_THRESHOLD) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is going to be wrong. The condition was "if min_times exceeds threshold or (max_times is defined and exceeds threshold)". Now, this is going to trigger if max_times is not defined (so with X{n,} patterns)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we're not going to use std::optional like I wanted in the first approach, then I think this is the only way to do it. This is bascially equivalent to checking for == -1 or, as the original test had it, < 0.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm ok I thought one of the condition was overlapping the other.

using uint_max as a special value is fine, the main advantage of std::optional is its readability which is easy to replicate: c0b9903

@pwilkin
Copy link
Collaborator

pwilkin commented Nov 20, 2025

LGTM now.

@pwilkin
Copy link
Collaborator

pwilkin commented Nov 20, 2025

(I can't merge BTW so you'll have to get someone with write access to approve a review)

@ngxson
Copy link
Collaborator Author

ngxson commented Nov 20, 2025

For extra safe, I'll merge when the windows CI on my fork passes (skipping long waiting line on the main repo)

@ngxson ngxson requested a review from ggerganov November 20, 2025 17:17
@ngxson ngxson requested a review from danbev November 20, 2025 17:18
@ngxson ngxson merged commit 054a45c into master Nov 20, 2025
59 of 65 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants