From here:
_shl: function (a, b){
for (++b; --b; a = ((a %= 0x7fffffff + 1) & 0x40000000) == 0x40000000 ? a * 2 : (a - 0x40000000) * 2 + 0x7fffff
I'm not sure how cross-browser the code is. I've used the method below for reading binary data. IE has some issues that can't be resolved with only Javascript, you need a small helper function written in VB. Here is a fully cross browser binary reader class. If you just want the bits that matter without all the helper functionality, just add this to the end of your class that needs to read binary:
// Add the helper functions in vbscript for IE browsers
// From https://gist.github.com/161492
if ($.browser.msie) {
document.write(
"\r\n"
);
}
Then you can pick whats right in your class add:
// Define the binary accessor function
if ($.browser.msie) {
this.getByteAt = function(binData, offset) {
return IEBinary_getByteAt(binData, offset);
}
} else {
this.getByteAt = function(binData, offset) {
return binData.charCodeAt(offset) & 0xFF;
}
}
Now you can read the bytes all you want
var byte = getByteAt.call(this, rawData, dataPos);