Skip to content

Remove pointless unsafe block in CilAssembler.cs #47

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

Open
SeeminglyScience opened this issue Jan 6, 2021 · 0 comments
Open

Remove pointless unsafe block in CilAssembler.cs #47

SeeminglyScience opened this issue Jan 6, 2021 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@SeeminglyScience
Copy link
Owner

byte* rawSignature = stackalloc byte[encoder.Builder.Count];
byte* c = rawSignature;
foreach (Blob blob in blobEncoder.Builder.GetBlobs())
{
foreach (byte b in blob.GetBytes())
{
*c++ = b;
}
}
_context.ILInfo.SetLocalSignature(rawSignature, blobEncoder.Builder.Count);

Saves one minor heap allocation every assemble, but not really worth the readability loss and the stackalloc doesn't guard against stack overflow.

@SeeminglyScience SeeminglyScience self-assigned this Jan 6, 2021
@SeeminglyScience SeeminglyScience added the enhancement New feature or request label Jan 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant