-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Optimize str_repeat #23128
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Optimize str_repeat #23128
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5524,7 +5524,8 @@ PHP_FUNCTION(str_repeat) | |
|
|
||
| while (e<ee) { | ||
| l = (e-s) < (ee-e) ? (e-s) : (ee-e); | ||
| memmove(e, s, l); | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. very close! the last line got 3 indentation levels too many
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. hmm, your comment was created is on the deleted memmove line, can you re-create the comment on the added memcpy line? |
||
| /* src [s, s+l) and dst [e, e+l) cannot overlap: l <= e-s */ | ||
| memcpy(e, s, l); | ||
|
divinity76 marked this conversation as resolved.
|
||
| e += l; | ||
| } | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you try using ```suggestion
like the codeblock language is "suggestion" ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aha, thx!I didn't know this trick! First time I've seen this. It's been ages since I used GitHub much. :)