PoL0/hqx

Visual 2010 compilation error

GoogleCodeExporter opened this issue · 0 comments

Ambiguous call:

/* Test if there is difference in color */
static inline int yuv_diff(uint32_t yuv1, uint32_t yuv2) {
    return (( abs((yuv1 & Ymask) - (yuv2 & Ymask)) > trY ) ||
            ( abs((yuv1 & Umask) - (yuv2 & Umask)) > trU ) ||
            ( abs((yuv1 & Vmask) - (yuv2 & Vmask)) > trV ) );
}

Error:
    10  IntelliSense: more than one instance of overloaded function "abs" matches the argument list:
            function "abs(int _X)"
            function "abs(long _X)"
            function "abs(long long _X)"
            argument types are: (unsigned int)  c:\Program Files\C++\Projects\HqxMAME\ScalerTest\hqx\common.h   51  15  ScalerTest

Solution: Explicitly cast value before calling "abs"

Original issue reported on code.google.com by zhnmju...@gmx.de on 25 Sep 2012 at 5:51