-
Notifications
You must be signed in to change notification settings - Fork 57
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
Supports numbers of different bases #219
Conversation
@abice Please check out my PR |
example/example_diff_base.go
Outdated
B6 = 0b110 | ||
B7 = 0b111 | ||
B8 = 0x08 | ||
B9 = 0x09 |
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.
Can you add some values in here that contain non standard hex values (letters, specifically)
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 support not only hexadecimal values, but also binary and octal values.
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.
Right, just make sure that 0x0f and 0xff parse correctly into the right values.
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.
Already added
} else if strings.HasPrefix(value, "0") && len(value) > 1 { | ||
return value[1:], 8 | ||
} |
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'm not sure I understand the benefit of this case. Do you mind elaborating a bit on why you would want this?
And what happens when you specify a value larger than the max?
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.
My intention is to support different representations of values in different binaries, in my project I usually use hexadecimal identifiers for these numbers, and if I convert to decimal for these values, it would be a problem to read the code. Of course, I could add comments to it and state the given value in the comments, but it feels like I'm adding to the problem.
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.
0XX is the number written in the base of the eight.
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.
Left a comment on this one a while ago about adding a extra test case.
No description provided.