Skip to content
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

Add a quickcheck for growing or shrinking existing allocations #233

Merged
merged 2 commits into from
Feb 15, 2024

Conversation

fitzgen
Copy link
Owner

@fitzgen fitzgen commented Feb 15, 2024

cc @overlookmotel: just an FYI in case you were interested in how I ended up doing this.

To gain access `next_multiple_of` and `ilog2` integer methods.
@fitzgen fitzgen merged commit 2543c41 into main Feb 15, 2024
8 checks passed
@fitzgen fitzgen deleted the grow-shrink-quickcheck branch February 15, 2024 20:40
@overlookmotel
Copy link
Contributor

I am interested. Thanks for pinging me.

Right, so the actual logic around grow/shrink and alignment had to change a bit, not just the test.

@fitzgen
Copy link
Owner Author

fitzgen commented Feb 15, 2024

That or alternatively the test could have accepted Err(_) in the case where requested new alignment was greater than the old alignment, but I figured I'd loosen things up a little while I was here.

@overlookmotel
Copy link
Contributor

overlookmotel commented Feb 15, 2024

Nice. Yes, I guess no reason to refuse to increase alignment, if the address is already aligned.

Can I ask you one random question that has nothing to do with this issue? (just don't want to open an issue/discussion just for 1 simple question)

Is the reason for filling the buffers backwards (start at the back, and move towards the front) to make alignment calculations more efficient?

@fitzgen
Copy link
Owner Author

fitzgen commented Feb 15, 2024

Is the reason for filling the buffers backwards (start at the back, and move towards the front) to make alignment calculations more efficient?

I wrote a whole blog post about this :)

https://fitzgeraldnick.com/2019/11/01/always-bump-downwards.html

@overlookmotel
Copy link
Contributor

Haha oops! Well I guess that answers my question (in spades). Thank you, will digest.

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.

None yet

2 participants