-
-
Save mewben/28f577bd2476fdca18bb4c0bfabd5d11 to your computer and use it in GitHub Desktop.
Revisions
-
aslakhellesoy revised this gist
Aug 9, 2011 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -3,7 +3,7 @@ long roundDown(long n, long m) { return n >= 0 ? (n / m) * m : ((n - m + 1) / m) * m; } /** round n up to nearest multiple of m */ long roundUp(long n, long m) { return n >= 0 ? ((n + m - 1) / m) * m : (n / m) * m; } -
aslakhellesoy created this gist
Aug 9, 2011 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,9 @@ /** round n down to nearest multiple of m */ long roundDown(long n, long m) { return n >= 0 ? (n / m) * m : ((n - m + 1) / m) * m; } /** round m up to nearest multiple of m */ long roundUp(long n, long m) { return n >= 0 ? ((n + m - 1) / m) * m : (n / m) * m; }