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

Add Itoa atoi syscalls #2043

Merged
merged 12 commits into from
Nov 8, 2020
Merged

Add Itoa atoi syscalls #2043

merged 12 commits into from
Nov 8, 2020

Conversation

shargon
Copy link
Member

@shargon shargon commented Nov 3, 2020

@@ -23,6 +27,21 @@ protected internal StackItem BinaryDeserialize(byte[] data)
return BinarySerializer.Deserialize(data, Limits.MaxStackSize, Limits.MaxItemSize, ReferenceCounter);
}

protected internal string Itoa(BigInteger value)
Copy link
Contributor

Choose a reason for hiding this comment

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

I think base parameter would be nice to have here (and for Atoi).

Copy link
Member Author

Choose a reason for hiding this comment

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

Please take a look, octal and binary was not added, do you think that it's needed?

Copy link
Contributor

Choose a reason for hiding this comment

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

To be fair I'd expect some regular 2-36 range to be supported here (like it's not a problem for big.Int in Go), but from a quick glance it looks like .NET's BigInteger doesn't make it easy even for 2-16 range (like in this SO q/a). So maybe we can try to go with only 10 and 16 supported for now, it's not that hard to extend it in the future if need be.

@shargon shargon merged commit 788b2b2 into neo-project:master Nov 8, 2020
@shargon shargon deleted the itoa-atoi branch November 8, 2020 09:23
@erikzhang erikzhang added this to the NEO 3.0 milestone Nov 9, 2020
ShawnYun pushed a commit to ShawnYun/neo that referenced this pull request Jan 8, 2021
* Itoa atoi

* add base

* Update src/neo/SmartContract/ApplicationEngine.Binary.cs

Co-authored-by: Erik Zhang <[email protected]>

* Update src/neo/SmartContract/ApplicationEngine.Binary.cs

Co-authored-by: Erik Zhang <[email protected]>

* Fix ut

* Clean code

* Update src/neo/SmartContract/ApplicationEngine.Binary.cs

Co-authored-by: Erik Zhang <[email protected]>

* Update src/neo/SmartContract/ApplicationEngine.Binary.cs

Co-authored-by: Erik Zhang <[email protected]>

* Fix ut

Co-authored-by: Erik Zhang <[email protected]>
cloud8little pushed a commit to cloud8little/neo that referenced this pull request Jan 24, 2021
* Itoa atoi

* add base

* Update src/neo/SmartContract/ApplicationEngine.Binary.cs

Co-authored-by: Erik Zhang <[email protected]>

* Update src/neo/SmartContract/ApplicationEngine.Binary.cs

Co-authored-by: Erik Zhang <[email protected]>

* Fix ut

* Clean code

* Update src/neo/SmartContract/ApplicationEngine.Binary.cs

Co-authored-by: Erik Zhang <[email protected]>

* Update src/neo/SmartContract/ApplicationEngine.Binary.cs

Co-authored-by: Erik Zhang <[email protected]>

* Fix ut

Co-authored-by: Erik Zhang <[email protected]>
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