Skip to content

PrivateAllocatorCapabilityState identity #259

Closed Answered by davidchisnall
PhilDay-CT asked this question in Q&A
Discussion options

You must be logged in to vote

The value will be truncated on assignment. Line 388 checks that it is a small enough value to be stored in the owner field of the chunk header, which is narrower than a 16-bit value and so, implicitly, that truncating to 16 bits will be sufficient. We store it as a 32-bit value so that we can do the overflow checks easily: if it overflows a 16-bit value by one, it’s still a valid 32-bit value and so the comparison on line 388 is safe and in range.

We should probably add:

  • A static assert check on that the chunk header owner ID width is narrower than (or equal width to) the field in the quota structure.
  • A comment explaining all of this.

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by davidchisnall
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants