-
Notifications
You must be signed in to change notification settings - Fork 131
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
Add fromBigEndianBytes
conversion function to Number
types
#2496
Add fromBigEndianBytes
conversion function to Number
types
#2496
Conversation
Codecov Report
@@ Coverage Diff @@
## master #2496 +/- ##
==========================================
+ Coverage 78.35% 78.39% +0.04%
==========================================
Files 327 327
Lines 73044 73262 +218
==========================================
+ Hits 57235 57436 +201
- Misses 13710 13720 +10
- Partials 2099 2106 +7
Flags with carried forward coverage won't be shown. Click here to find out more.
|
Just realized that #1917 fixed the behaviour for |
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.
Nice!
Co-authored-by: Bastian Müller <bastian@turbolent.com>
@turbolent sure, I can switch the branch to stable cadence if needed. In future, when the stable cadence branch is fully merged into master, these changes will also come in. Do let me know. |
Sorry, I missed this. Does the new API Otherwise, If we'll have to do any adjustments, then merging to Stable Cadence directly sounds like a good idea. It would save us the trouble of having to maintain two versions of this / update to match the Stable cadence later on (which could fall through the cracks). But like I said, if this is not the case, then I'm OK with merging to master. |
@SupunS Yes, it works for both the cases. For variable-sized inputs, we add the necessary padding. |
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.
Nice work!
@onflow/cadence could you please have a look? |
Closes #2448
Work towards onflow/developer-grants#179
Description
Added
fromBigEndianBytes
to all theNumber
types -Int*
,UInt*
,Fix*
,Word*
.We return
Nil
in case of invalid input such as overflow. Note that we also returnNil
if the size of the byte array is greater than the size needed for the target type. E.g.[0, 0]
does not lead to overflow forUInt8
but we returnNil
since we expect the byte array size to only be 1.master
branchFiles changed
in the Github PR explorer