You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
if (b <=0x7f|| b >=0xe0) {
/// Int value in fixnum range [-32..127] encoded in header 1 byte
v = _d.getInt8(_offset);
_offset +=1;
} elseif (b ==0xcc) {
v = _d.getUint8(++_offset);
_offset +=1;
} elseif (...) {
} else {
throw_formatException('integer', b);
}
isn't it better if we change it to use switch instead of those ifs?
ie:
if (b <=0x7f|| b >=0xe0) {
/// Int value in fixnum range [-32..127] encoded in header 1 byte
v = _d.getInt8(_offset);
_offset +=1;
} else {
switch (b) {
case b ==0xcc:
v = _d.getUint8(++_offset);
_offset +=1;
break;
default:throw_formatException('integer', b);
}
I am not sure, but maybe the compiler uses a goto with the switch but not with the if-elseif because of the first if block (b <= 0x7f || b >= 0xe0).
The text was updated successfully, but these errors were encountered:
Take the
unpackInt
as example:isn't it better if we change it to use switch instead of those ifs?
ie:
I am not sure, but maybe the compiler uses a goto with the switch but not with the if-elseif because of the first if block
(b <= 0x7f || b >= 0xe0)
.The text was updated successfully, but these errors were encountered: