Reordered unpack selector sequence.

This commit is contained in:
Takatoshi Kondo 2014-08-07 10:40:21 +09:00
parent 7822bc787d
commit b5b459cfca

View File

@ -333,29 +333,7 @@ public:
unpack_int8(*reinterpret_cast<const int8_t*>(m_current), obj); unpack_int8(*reinterpret_cast<const int8_t*>(m_current), obj);
int ret = push_proc(obj, off); int ret = push_proc(obj, off);
if (ret != 0) return ret; if (ret != 0) return ret;
} else if(0xc0 <= selector && selector <= 0xc3) { // nil, bool } else if (0xc4 <= selector && selector <= 0xdf) {
switch(selector) {
case 0xc0: { // nil
unpack_nil(obj);
int ret = push_proc(obj, off);
if (ret != 0) return ret;
} break;
//case 0xc1: // string
case 0xc2: { // false
unpack_false(obj);
int ret = push_proc(obj, off);
if (ret != 0) return ret;
} break;
case 0xc3: { // true
unpack_true(obj);
int ret = push_proc(obj, off);
if (ret != 0) return ret;
} break;
}
}
else if (0xc4 <= selector && selector <= 0xdf) {
const uint32_t trail[] = { const uint32_t trail[] = {
1, // bin 8 0xc4 1, // bin 8 0xc4
2, // bin 16 0xc5 2, // bin 16 0xc5
@ -409,6 +387,18 @@ public:
int ret = push_aggregate<fix_tag>( int ret = push_aggregate<fix_tag>(
unpack_map(), CT_MAP_KEY, obj, m_current, off); unpack_map(), CT_MAP_KEY, obj, m_current, off);
if (ret != 0) return ret; if (ret != 0) return ret;
} else if(selector == 0xc2) { // false
unpack_false(obj);
int ret = push_proc(obj, off);
if (ret != 0) return ret;
} else if(selector == 0xc3) { // true
unpack_true(obj);
int ret = push_proc(obj, off);
if (ret != 0) return ret;
} else if(selector == 0xc0) { // nil
unpack_nil(obj);
int ret = push_proc(obj, off);
if (ret != 0) return ret;
} else { } else {
off = m_current - m_start; off = m_current - m_start;
return -1; return -1;