diff options
author | srs5694 <srs5694@users.sourceforge.net> | 2011-03-16 02:42:33 -0400 |
---|---|---|
committer | srs5694 <srs5694@users.sourceforge.net> | 2011-03-16 02:42:33 -0400 |
commit | c2f6e0cb812dd08fdb8f8cabda4f08a070c6f9fe (patch) | |
tree | 24934b43df063f9889923f8c6b373f84aca66932 /mbrpart.cc | |
parent | 01f7f08624f0c942001977415214a578621f6495 (diff) | |
download | sgdisk-c2f6e0cb812dd08fdb8f8cabda4f08a070c6f9fe.tar.gz |
A few miscellaneous changes
Diffstat (limited to 'mbrpart.cc')
-rw-r--r-- | mbrpart.cc | 12 |
1 files changed, 12 insertions, 0 deletions
@@ -102,6 +102,18 @@ MBRPart& MBRPart::operator=(const struct MBRRecord& orig) { return *this; } // MBRPart::operator=(const struct MBRRecord& orig) +// Compare the values, and return a bool result. +// Because this is intended for sorting and a lengthLBA value of 0 denotes +// a partition that's not in use and so that should be sorted upwards, +// we return the opposite of the usual arithmetic result when either +// lengthLBA value is 0. +bool MBRPart::operator<(const MBRPart &other) const { + if (lengthLBA && other.lengthLBA) + return (firstLBA < other.firstLBA); + else + return (other.firstLBA < firstLBA); +} // operator<() + /************************************************** * * * Set information on partitions or disks without * |