Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Conversation

@benaadams
Copy link
Member

No description provided.

// - But this is only up to a maximum, so we stay in the small object heap, and never allocate
// really big chunks even if the string gets really big.
int newBlockLength = Math.Max(minBlockCharCount, Math.Min(Length, MaxChunkSize));
int newBlockLength = Math.Clamp(Length, minBlockCharCount, MaxChunkSize);
Copy link
Member

Choose a reason for hiding this comment

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

This will now throw if MaxChunkSize < minBlockCharCount. I don't think it can be, though.

Copy link
Member Author

Choose a reason for hiding this comment

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

Append('a', repeatCount: MaxChunkSize + 1) 😦

@benaadams
Copy link
Member Author

Looks like max < min may be true in some cases and then clamp with throw :(

@benaadams benaadams closed this Feb 6, 2018
@benaadams benaadams deleted the clamp branch February 6, 2018 03:58
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants