Closed kimwalisch closed 8 years ago
I saw your code:
uint32_t absD = 1U << shift; if (more & LIBDIVIDE_NEGATIVE_DIVISOR) { #if LIBDIVIDE_VC #pragma warning( suppress : 4146 ) absD = -absD; #else absD = -absD; #endif }
I came across the same issue a few years ago and found a shorter solution (which I use here):
uint32_t absD = 1U << shift; if (more & LIBDIVIDE_NEGATIVE_DIVISOR) { absD = absD * (uint32_t)-1; }
I guess the compiler will generate the same code but you avoid the ugly pragma.
Nice tip! Thanks!!
I saw your code:
I came across the same issue a few years ago and found a shorter solution (which I use here):
I guess the compiler will generate the same code but you avoid the ugly pragma.