Git-Url: http://git.frugalware.org/gitweb/gitweb.cgi?p=fwsetup-ng.git;a=commitdiff;h=33d76edbc50ddcf239b203803f9517cd581641b7
commit 33d76edbc50ddcf239b203803f9517cd581641b7 Author: James Buren <[email protected]> Date: Sun Aug 26 15:59:55 2012 -0500 add math functions for aligning partitions diff --git a/Device.hh b/Device.hh index 7c477ec..c5eb5a0 100644 --- a/Device.hh +++ b/Device.hh @@ -22,6 +22,20 @@ public: Partition *newPartition(unsigned long long size); private: + unsigned long long alignUp(unsigned long long sector) + { + if((sector % _alignment) == 0) + return sector; + + return sector + (_alignment - (sector % _alignment)); + } + unsigned long long alignDown(unsigned long long sector) + { + if((sector % _alignment) == 0) + return sector; + + return sector - (sector % _alignment)); + } string _path; unsigned long long _sectorsize; unsigned long long _alignment; _______________________________________________ Frugalware-git mailing list [email protected] http://frugalware.org/mailman/listinfo/frugalware-git
