Index: lib/src/hash_sink.dart |
diff --git a/lib/src/hash_sink.dart b/lib/src/hash_sink.dart |
index a3cef94c4a9a17c760072dd87a84bac3a5dce16b..f4adcb3da61e7ffee13c474d69b22c6eaa7bde45 100644 |
--- a/lib/src/hash_sink.dart |
+++ b/lib/src/hash_sink.dart |
@@ -128,7 +128,20 @@ abstract class HashSink implements Sink<List<int>> { |
// hash. |
var offset = _pendingData.length; |
_pendingData.addAll(new Uint8List(8)); |
- _pendingData.buffer.asByteData().setUint64(offset, lengthInBits, _endian); |
+ var byteData = _pendingData.buffer.asByteData(); |
+ |
+ // We're essentially doing byteData.setUint64(offset, lengthInBits, _endian) |
+ // here, but that method isn't supported on dart2js so we implement it |
+ // manually instead. |
+ var highBits = lengthInBits >> 32; |
sra1
2016/03/23 22:15:50
This won't actually do what you want in dart2js.
d
nweiz
2016/03/23 22:21:26
Presumably in dart2js, lengthInBits can't be highe
|
+ var lowBits = lengthInBits & mask32; |
+ if (_endian == Endianness.BIG_ENDIAN) { |
+ byteData.setUint32(offset, highBits, _endian); |
+ byteData.setUint32(offset + bytesPerWord, lowBits, _endian); |
+ } else { |
+ byteData.setUint32(offset, lowBits, _endian); |
+ byteData.setUint32(offset + bytesPerWord, highBits, _endian); |
+ } |
} |
/// Rounds [val] up to the next multiple of [n], as long as [n] is a power of |