Only use offset optimization for string types in HEADERIMPORT_FAST (#398)
Only string types benefit from the offset-based optimization, for other types the operation is a trivial constant-time calculation anyway and getting inaccurate length information (due to alignment of next item getting included) in return for a non-optimization is nothing but a bad trade.
This commit is contained in:
parent
5ac4305bdd
commit
0093584a6a
|
@ -497,7 +497,8 @@ static int regionSwab(indexEntry entry, int il, int dl,
|
|||
if (dataEnd && (unsigned char *)ie.data >= dataEnd)
|
||||
return -1;
|
||||
|
||||
if (fast && il > 1) {
|
||||
/* The offset optimization is only relevant for string types */
|
||||
if (fast && il > 1 && typeSizes[ie.info.type] == -1) {
|
||||
ie.length = ntohl(pe[1].offset) - ie.info.offset;
|
||||
} else {
|
||||
ie.length = dataLength(ie.info.type, ie.data, ie.info.count,
|
||||
|
|
Loading…
Reference in New Issue