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

Memory is safe again #148

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open

Memory is safe again #148

wants to merge 6 commits into from

Conversation

uselessgoddess
Copy link
Member

Fix .Equals bug from #136

@@ -77,11 +77,11 @@ private static bool CheckArraysMainPartForEquality(ref char* left, ref char* rig
{
while (length >= 10)
{
if ((*(int*)left != *(int*)right)
Copy link
Member

Choose a reason for hiding this comment

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

Why.....?

Copy link
Member Author

Choose a reason for hiding this comment

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

What why?

Copy link
Member

Choose a reason for hiding this comment

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

@uselessgoddess, why did you removed braces? They make code less error prone

Copy link
Member Author

Choose a reason for hiding this comment

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

Sorry dear @FreePhoenix888, my ide did this

Copy link
Member Author

Choose a reason for hiding this comment

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

But braces make code error prone:)

Copy link
Member

Choose a reason for hiding this comment

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

I disagree

Copy link
Member Author

Choose a reason for hiding this comment

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

Comment on lines +80 to +84
if (*(int*)left != *(int*)right
|| *(int*)(left + 2) != *(int*)(right + 2)
|| *(int*)(left + 4) != *(int*)(right + 4)
|| *(int*)(left + 6) != *(int*)(right + 6)
|| *(int*)(left + 8) != *(int*)(right + 8))
Copy link
Member Author

Choose a reason for hiding this comment

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

Suggested change
if (*(int*)left != *(int*)right
|| *(int*)(left + 2) != *(int*)(right + 2)
|| *(int*)(left + 4) != *(int*)(right + 4)
|| *(int*)(left + 6) != *(int*)(right + 6)
|| *(int*)(left + 8) != *(int*)(right + 8))
if ((*(int*)left != *(int*)right
|| (*(int*)(left + 2) != *(int*)(right + 2))
|| (*(int*)(left + 4) != *(int*)(right + 4))
|| (*(int*)(left + 6) != *(int*)(right + 6))
|| (*(int*)(left + 8) != *(int*)(right + 8)))

@uselessgoddess
Copy link
Member Author

Bump.

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.

3 participants