Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 49933fd

Browse files
committedFeb 6, 2015
Merge pull request cscheid#27 from att/unsigned-right-shift
use the JavaScript unsigned right-shift operator >>>
2 parents 474940b + a212831 commit 49933fd

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed
 

‎src/parse.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ function parse(msg)
212212
{
213213
var result = {};
214214
var header = new Int32Array(msg, 0, 4);
215-
var resp = header[0] & 16777215, status_code = header[0] >> 24;
215+
var resp = header[0] & 16777215, status_code = header[0] >>> 24;
216216
var msg_id = header[2];
217217
result.header = [resp, status_code, msg_id];
218218

‎src/rserve.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ Rserve.create = function(opts) {
9090
// can't left shift value here because value will have bit 32 set and become signed..
9191
view.data_view().setInt32(0, Rserve.Rsrv.DT_SEXP + ((sz & 16777215) * Math.pow(2, 8)) + Rserve.Rsrv.DT_LARGE);
9292
// but *can* right shift because we assume sz is less than 2^31 or so to begin with
93-
view.data_view().setInt32(4, sz >> 24);
93+
view.data_view().setInt32(4, sz >>> 24);
9494
Rserve.write_into_view(value, view.skip(8), forced_type, convert_to_hash);
9595
return buffer;
9696
} else {

‎src/rsrv.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33

44
Rserve.Rsrv = {
55
PAR_TYPE: function(x) { return x & 255; },
6-
PAR_LEN: function(x) { return x >> 8; },
7-
PAR_LENGTH: function(x) { return x >> 8; },
6+
PAR_LEN: function(x) { return x >>> 8; },
7+
PAR_LENGTH: function(x) { return x >>> 8; },
88
par_parse: function(x) { return [Rserve.Rsrv.PAR_TYPE(x), Rserve.Rsrv.PAR_LEN(x)]; },
99
SET_PAR: function(ty, len) { return ((len & 0xffffff) << 8 | (ty & 255)); },
10-
CMD_STAT: function(x) { return (x >> 24) & 127; },
10+
CMD_STAT: function(x) { return (x >>> 24) & 127; },
1111
SET_STAT: function(x, s) { return x | ((s & 127) << 24); },
1212

1313
IS_OOB_SEND: function(x) { return (x & 0xffff000) === Rserve.Rsrv.OOB_SEND; },

‎src/write.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ Rserve.write_into_view = function(value, array_buffer_view, forced_type, convert
133133
if (is_large) {
134134
payload_start = 8;
135135
write_view.setInt32(0, t + ((size - 8) << 8));
136-
write_view.setInt32(4, (size - 8) >> 24);
136+
write_view.setInt32(4, (size - 8) >>> 24);
137137
} else {
138138
payload_start = 4;
139139
write_view.setInt32(0, t + ((size - 4) << 8));

0 commit comments

Comments
 (0)
Failed to load comments.