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

Unified Diff: lib/src/utils.dart

Issue 1349373002: Improve the style of code in lib/. (Closed) Base URL: git@github.com:dart-lang/crypto.git@master
Patch Set: Code review changes Created 5 years, 3 months 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
« no previous file with comments | « lib/src/sha256.dart ('k') | pubspec.yaml » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/src/utils.dart
diff --git a/lib/src/utils.dart b/lib/src/utils.dart
index f2f265db1830e66739c6a6fd4c04410181de2c17..c108c3a1b27ff3400be9cdc32e2b86e546a6a792 100644
--- a/lib/src/utils.dart
+++ b/lib/src/utils.dart
@@ -4,25 +4,25 @@
library crypto.utils;
-/// A bitmask that limits an integer to 8 bits.
-const MASK_8 = 0xff;
-
/// A bitmask that limits an integer to 32 bits.
-const MASK_32 = 0xffffffff;
+const mask32 = 0xFFFFFFFF;
+
+/// The highest value representable by a 64-bit unsigned integer.
+const maxUint64 = 0xFFFFFFFFFFFFFFFF;
/// The number of bits in a byte.
-const BITS_PER_BYTE = 8;
+const bitsPerByte = 8;
/// The number of bytes in a 32-bit word.
-const BYTES_PER_WORD = 4;
+const bytesPerWord = 4;
/// Adds [x] and [y] with 32-bit overflow semantics.
-int add32(x, y) => (x + y) & MASK_32;
+int add32(int x, int y) => (x + y) & mask32;
/// Bitwise rotates [val] to the left by [shift], obeying 32-bit overflow
/// semantics.
int rotl32(int val, int shift) {
- var mod_shift = shift & 31;
- return ((val << mod_shift) & MASK_32) |
- ((val & MASK_32) >> (32 - mod_shift));
+ var modShift = shift & 31;
+ return ((val << modShift) & mask32) |
+ ((val & mask32) >> (32 - modShift));
}
« no previous file with comments | « lib/src/sha256.dart ('k') | pubspec.yaml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698