Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(153)

Unified Diff: runtime/vm/bigint_operations.cc

Issue 88983004: Support Bigint parameters in Int32x4 constructor (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: runtime/vm/bigint_operations.cc
diff --git a/runtime/vm/bigint_operations.cc b/runtime/vm/bigint_operations.cc
index c77eb42a52054cdb0ff57ed52fa50a115d939f04..d036fde74b7d870b83bf73ddac6958d122996b78 100644
--- a/runtime/vm/bigint_operations.cc
+++ b/runtime/vm/bigint_operations.cc
@@ -693,6 +693,16 @@ int64_t BigintOperations::ToInt64(const Bigint& bigint) {
}
+uint32_t BigintOperations::TruncateToUint32(const Bigint& bigint) {
+ uint32_t value = 0;
+ for (intptr_t i = bigint.Length() - 1; i >= 0; i--) {
+ value <<= kDigitBitSize;
+ value += static_cast<uint32_t>(bigint.GetChunkAt(i));
+ }
+ return value;
+}
+
+
bool BigintOperations::AbsFitsIntoUint64(const Bigint& bigint) {
intptr_t b_length = bigint.Length();
intptr_t num_bits = CountBits(bigint.GetChunkAt(b_length - 1));
« no previous file with comments | « runtime/vm/bigint_operations.h ('k') | runtime/vm/object.h » ('j') | runtime/vm/object.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698