Re: Change in dart/sdk[master]: Add BigInt.fromBytes/writeBytes.

Skip to first unread message

Kevin Moore

Jan 23, 2019, 1:26:28 PM1/23/19
to, Lasse R.H. Nielsen,,,
I'm guessing any impl we do on the JS side would be no worse than what a user could/would do by hand, right?

On Wed, Jan 23, 2019 at 10:16 AM Stephen Adams (Gerrit) <> wrote:

Patch Set 1:

Is there any reasonable way someone could implement/extend BigInt?

We don't require our users to be reasonable.

Another issue is that this code isn't actually particularly efficient for negative numbers.
The internal representation is signed magnitude, not two's complement, so we have to do conversion to expose a two's complement value.
So, maybe it's not the best API to use. Converting from unsigned Uint32List to signed Uint8List is a non-trivial conversion, it's not just "giving access to the underlying data".
s this what we want?
Is this an API that can be supported in JavaScript using their built-in bignums?

JavaScript BigInts do not have any methods useful for implementing this API.
The best you could do is construct/destruct via arithmetic.

So, don't assume that this is *anyhing* other than an experiment (and I uploaded it only because I couldn't build it locally because my repository has some issue).

View Change

    To view, visit change 90391. To unsubscribe, or for help writing mail filters, visit settings.

    Gerrit-Project: sdk
    Gerrit-Branch: master
    Gerrit-Change-Id: Ib9af5756e3d3d0bc65b117207d8ccda0ce547bd7
    Gerrit-Change-Number: 90391
    Gerrit-PatchSet: 1
    Gerrit-Owner: Lasse R.H. Nielsen <>
    Gerrit-Reviewer: Lasse R.H. Nielsen <>
    Gerrit-CC: Kevin Moore <>
    Gerrit-CC: Stephen Adams <>
    Gerrit-Comment-Date: Wed, 23 Jan 2019 18:16:44 +0000
    Gerrit-HasComments: No
    Gerrit-Has-Labels: No
    Gerrit-MessageType: comment
    Reply all
    Reply to author
    0 new messages