1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-01-30 15:52:12 +01:00

Patch from PH which orders fields by size - important for using the M4 FPU

This commit is contained in:
James Cotton 2011-11-14 09:49:50 -06:00
parent 76a956416c
commit 3e2558bec6

View File

@ -111,6 +111,11 @@ int UAVObjectParser::getNumBytes(int objIndex)
}
}
bool fieldTypeLessThan(const FieldInfo* f1, const FieldInfo* f2)
{
return f1->numBytes > f2->numBytes;
}
/**
* Parse supplied XML file
* @param xml The xml text
@ -201,6 +206,9 @@ QString UAVObjectParser::parseXML(QString& xml, QString& filename)
childNode = childNode.nextSibling();
}
// Sort all fields according to size
qStableSort(info->fields.begin(), info->fields.end(), fieldTypeLessThan);
// Make sure that required elements were found
if ( !accessFound )
return QString("Object::access element is missing");