Skip to content
This repository was archived by the owner on Oct 17, 2024. It is now read-only.

Remove 64 bit int constant so that dart2js can compile with crypto. #51

Merged
merged 2 commits into from
Jun 7, 2018
Merged

Conversation

efortuna
Copy link
Contributor

@efortuna efortuna commented Jun 7, 2018

This change.... is so hair-brained I just can't even.....

The context is dart2js now has full JS number semantics, so it will cough on numbers that are not precisely representable as a double (generally > 2^53). I got around that by making this a BigNum, but it's pretty idiotic. I welcome alternatives. :-/

@efortuna efortuna requested a review from nex3 June 7, 2018 01:25
@efortuna efortuna requested a review from kevmoo June 7, 2018 01:25
Copy link
Contributor

@kevmoo kevmoo left a comment

Choose a reason for hiding this comment

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

Please bump the version to 2.0.4 and add a changelog entry!

@efortuna
Copy link
Contributor Author

efortuna commented Jun 7, 2018

oops, thank you! Updated!

Copy link
Contributor

@kevmoo kevmoo left a comment

Choose a reason for hiding this comment

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

LGTM! Please "squash and merge" when travis is green.

@efortuna efortuna merged commit c714b42 into dart-archive:master Jun 7, 2018
@rakudrama
Copy link

2^64 bits several Exa-bytes.
I would simply make the max bits be 2^53 (2^53 bits is a Peta-byte, so won't fit on non-sharded storage for a while).
The code probably counts bits or bytes so JavaScript will count them wrong if your message is over a Petabyte.

@@ -25,10 +26,6 @@ abstract class HashSink implements Sink<List<int>> {
/// used across invocations of [_iterate].
final Uint32List _currentChunk;

/// Messages with more than 2^64-1 bits are not supported.
/// So the maximum length in bytes is (2^64-1)/8.
static const _maxMessageLengthInBytes = 0x1fffffffffffffff;
Copy link

@rakudrama rakudrama Jun 7, 2018

Choose a reason for hiding this comment

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

Use 0x0003FFFFFFFFFFFF instead
The largest number of bytes for which we can count the bits portably across VM and JavaScript, i.e. (2^53-1)/8

mosuem pushed a commit to dart-lang/core that referenced this pull request Oct 15, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Development

Successfully merging this pull request may close these issues.

4 participants