-
Notifications
You must be signed in to change notification settings - Fork 10.4k
Make GetFinalTransferCoding "safe" #21202
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
Conversation
const ulong lowerCaseULong = 0x0020_0020_0020_0020; | ||
const uint lowerCaseUInt = 0x0020_0020; | ||
|
||
const ulong hunkChars = 0x006b_006e_0075_0068; // 4 chars "hunk" |
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.
These are "funny" names 😉
What about chunkRemainderChars
or that like, so that it's not that obscure to read if you're not in the mental context of the method?
I thought the same in #21004
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.
Renamed a little
|
||
var byteValue = MemoryMarshal.AsBytes(value); | ||
|
||
if ((c | lowerCaseChar) == 'c' && |
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.
I see this (good) pattern repeated several times (also in the other PRs).
Maybe this can be refactored with the struct-trick (I'm sure you get the idea)
But I don't know if this is a win code-wise. The constants (see comment above) could be wrapped in more obvious names that way and the logic re-used.
Together with a potential SIMD-approach (if it's worth it) the code would get cleaner.
Perf-wise it should result in the same.
b78ca3d
to
480fe06
Compare
480fe06
to
67588d5
Compare
To @blowdart with ❤
Contributes to #4720