File tree Expand file tree Collapse file tree 1 file changed +16
-2
lines changed
Expand file tree Collapse file tree 1 file changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -1486,14 +1486,28 @@ init_struct(void)
14861486 other = lilendian_table ;
14871487 else
14881488 other = bigendian_table ;
1489+ /* Scan through the native table, find a matching
1490+ entry in the endian table and swap in the
1491+ native implementations whenever possible
1492+ (64-bit platforms may not have "standard" sizes) */
14891493 while (native -> format != '\0' && other -> format != '\0' ) {
14901494 ptr = other ;
14911495 while (ptr -> format != '\0' ) {
14921496 if (ptr -> format == native -> format ) {
1493- ptr -> pack = native -> pack ;
1494- ptr -> unpack = native -> unpack ;
1497+ /* Match faster when formats are
1498+ listed in the same order */
14951499 if (ptr == other )
14961500 other ++ ;
1501+ /* Only use the trick if the
1502+ size matches */
1503+ if (ptr -> size != native -> size )
1504+ break ;
1505+ /* Skip float and double, could be
1506+ "unknown" float format */
1507+ if (ptr -> format == 'd' || ptr -> format == 'f' )
1508+ break ;
1509+ ptr -> pack = native -> pack ;
1510+ ptr -> unpack = native -> unpack ;
14971511 break ;
14981512 }
14991513 ptr ++ ;
You can’t perform that action at this time.
0 commit comments