Skip to content

Commit

Permalink
Add types to shift operations
Browse files Browse the repository at this point in the history
Not sure why these weren't typed in the first place.

[email protected]

Review URL: https://codereview.chromium.org/1143273002
  • Loading branch information
vsmenon committed May 22, 2015
1 parent e270186 commit 980c090
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 19 deletions.
26 changes: 13 additions & 13 deletions pkg/dev_compiler/lib/runtime/dart/_interceptors.js
Original file line number Diff line number Diff line change
Expand Up @@ -439,11 +439,11 @@ var _js_embedded_names = dart.import(_js_embedded_names);
return JSInt._bitCount(JSInt._spread(nonneg));
}
static _bitCount(i) {
i = dart.as(dart.dsend(JSInt._shru(i, 0), '-', dart.dsend(JSInt._shru(i, 1), '&', 1431655765)), core.int);
i = (dart.notNull(i) & 858993459)['+'](dart.as(dart.dsend(JSInt._shru(i, 2), '&', 858993459), core.num));
i = 252645135 & dart.notNull(dart.notNull(i) + dart.notNull(dart.as(JSInt._shru(i, 4), core.num)));
i = dart.notNull(i) + dart.notNull(dart.as(JSInt._shru(i, 8), core.int));
i = dart.notNull(i) + dart.notNull(dart.as(JSInt._shru(i, 16), core.int));
i = dart.notNull(JSInt._shru(i, 0)) - (dart.notNull(JSInt._shru(i, 1)) & 1431655765);
i = (dart.notNull(i) & 858993459) + (dart.notNull(JSInt._shru(i, 2)) & 858993459);
i = 252645135 & dart.notNull(i) + dart.notNull(JSInt._shru(i, 4));
i = dart.notNull(i) + dart.notNull(JSInt._shru(i, 8));
i = dart.notNull(i) + dart.notNull(JSInt._shru(i, 16));
return dart.notNull(i) & 63;
}
static _shru(value, shift) {
Expand All @@ -456,11 +456,11 @@ var _js_embedded_names = dart.import(_js_embedded_names);
return a | b;
}
static _spread(i) {
i = dart.as(JSInt._ors(i, dart.as(JSInt._shrs(i, 1), core.int)), core.int);
i = dart.as(JSInt._ors(i, dart.as(JSInt._shrs(i, 2), core.int)), core.int);
i = dart.as(JSInt._ors(i, dart.as(JSInt._shrs(i, 4), core.int)), core.int);
i = dart.as(JSInt._ors(i, dart.as(JSInt._shrs(i, 8), core.int)), core.int);
i = dart.as(JSInt._shru(dart.as(JSInt._ors(i, dart.as(JSInt._shrs(i, 16), core.int)), core.int), 0), core.int);
i = JSInt._ors(i, JSInt._shrs(i, 1));
i = JSInt._ors(i, JSInt._shrs(i, 2));
i = JSInt._ors(i, JSInt._shrs(i, 4));
i = JSInt._ors(i, JSInt._shrs(i, 8));
i = JSInt._shru(JSInt._ors(i, JSInt._shrs(i, 16)), 0);
return i;
}
get runtimeType() {
Expand All @@ -480,9 +480,9 @@ var _js_embedded_names = dart.import(_js_embedded_names);
}),
statics: () => ({
_bitCount: [core.int, [core.int]],
_shru: [core.Object, [core.int, core.int]],
_shrs: [core.Object, [core.int, core.int]],
_ors: [core.Object, [core.int, core.int]],
_shru: [core.int, [core.int, core.int]],
_shrs: [core.int, [core.int, core.int]],
_ors: [core.int, [core.int, core.int]],
_spread: [core.int, [core.int]]
}),
names: ['_bitCount', '_shru', '_shrs', '_ors', '_spread']
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -393,9 +393,9 @@ class JSInt extends JSNumber implements int, double {
return (i & 0x0000003F);
}

static _shru(int value, int shift) => JS('int', '# >>> #', value, shift);
static _shrs(int value, int shift) => JS('int', '# >> #', value, shift);
static _ors(int a, int b) => JS('int', '# | #', a, b);
static int _shru(int value, int shift) => JS('int', '# >>> #', value, shift);
static int _shrs(int value, int shift) => JS('int', '# >> #', value, shift);
static int _ors(int a, int b) => JS('int', '# | #', a, b);

// Assumes i is <= 32-bit
static int _spread(int i) {
Expand Down
6 changes: 3 additions & 3 deletions pkg/dev_compiler/tool/input_sdk/private/js_number.dart
Original file line number Diff line number Diff line change
Expand Up @@ -393,9 +393,9 @@ class JSInt extends JSNumber implements int, double {
return (i & 0x0000003F);
}

static _shru(int value, int shift) => JS('int', '# >>> #', value, shift);
static _shrs(int value, int shift) => JS('int', '# >> #', value, shift);
static _ors(int a, int b) => JS('int', '# | #', a, b);
static int _shru(int value, int shift) => JS('int', '# >>> #', value, shift);
static int _shrs(int value, int shift) => JS('int', '# >> #', value, shift);
static int _ors(int a, int b) => JS('int', '# | #', a, b);

// Assumes i is <= 32-bit
static int _spread(int i) {
Expand Down

0 comments on commit 980c090

Please sign in to comment.