-
Notifications
You must be signed in to change notification settings - Fork 35
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
Bit syntax integer signedness #283
Bit syntax integer signedness #283
Conversation
Actually I think there's still a problem. -spec receiver(binary()) -> non_neg_integer().
receiver(B) ->
<<I>> = B,
I.
-spec emitter(integer()) -> binary().
emitter(I) ->
B = <<I>>,
B. I think for Considering the following: 1> <<A/unsigned>> = <<-1>>.
<<"ÿ">>
2> A.
255
3> <<B/signed>> = <<-1>>.
<<"ÿ">>
4> B.
-1 I think it should allow any sort of integer if it's on RHS, right? |
From linked article:
|
Codecov Report
@@ Coverage Diff @@
## master #283 +/- ##
==========================================
+ Coverage 87.68% 87.71% +0.02%
==========================================
Files 18 18
Lines 2656 2661 +5
==========================================
+ Hits 2329 2334 +5
Misses 327 327
Continue to review full report at Codecov.
|
Indeed. Fixed with the new commit. |
Great! Add your examples as test too 😃 |
Should be good now. Requests approvals and I think this is ready to merge. |
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.
Very good! I just have a few style comments. Hope you agree.
I agreed with all of them :) |
Awesome! Then I have just one more but just it's a comment about a comment... |
Should I merge? |
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.
Great! I will squash and merge.
Or better you merge yourself, you can squash as you want. 👍 |
Respect default unsignedness for integer bit-string matching.
According to https://erlang.org/doc/programming_examples/bit_syntax.html#defaults
The default signedness for integer is
unsigned
. Feed on the specifiers to control signedness and make the defaultunsigned
, which leads to unspecified signedness going frominteger()
tonon_neg_integer()
.