diff options
author | Max Horn | 2011-02-09 00:11:39 +0000 |
---|---|---|
committer | Max Horn | 2011-02-09 00:11:39 +0000 |
commit | 2184326dbc428d7b6ef1eda510ae299838d5a2d2 (patch) | |
tree | e9e9994c61541b5a03937b83e55192c2280fb707 /common | |
parent | 93d22c21b58685a7044bcedefcd174c68f02e2a1 (diff) | |
download | scummvm-rg350-2184326dbc428d7b6ef1eda510ae299838d5a2d2.tar.gz scummvm-rg350-2184326dbc428d7b6ef1eda510ae299838d5a2d2.tar.bz2 scummvm-rg350-2184326dbc428d7b6ef1eda510ae299838d5a2d2.zip |
COMMON: Add comment that explains strange <= checks in gcd()
svn-id: r55838
Diffstat (limited to 'common')
-rw-r--r-- | common/algorithm.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/common/algorithm.h b/common/algorithm.h index b34d6f852d..e5c5f81433 100644 --- a/common/algorithm.h +++ b/common/algorithm.h @@ -242,6 +242,9 @@ void sort(T first, T last) { */ template<class T> T gcd(T a, T b) { + // Note: We check for <= instead of < to avoid spurious compiler + // warnings if T is an unsigned type, i.e. warnings like "comparison + // of unsigned expression < 0 is always false". if (a <= 0) a = -a; if (b <= 0) |