Tater,
The problem as I see it is not the code but every compiler I have tested gives the same results except Pelles 7.
I use many different compilers with bcx and PellesC was my first choice for "c" code; but ver 7 is not consistent with any others including PellesC 6.5.
Hello James and Robert...
I'm not saying it isn't a bug. I was only suggesting a simple experiment to help track down the problem.
That said...
I tried a very simple test here and it would appear that in logical comparisons, including == the compiler's internal logic sees no difference between signed and unsigned char and clearly -32 and 224 are not the same (although they share the same bit pattern).
Typecasting did nothing for me. It was not until I actually assigned the char values to int variables that I got the correct answers.
But, something very interesting happened while playing with the project... if I turned off the optimizer I suddenly got the right answers...
A Demo project is attached, try compiling it without optimizations then with any optimization you choose... look at your answers. The attached screen snip show both results... the top one is optimizations off, the bottom one is set to maximize speed.
So it would appear this is an optimization problem that can be fixed by bracketing your function...
#pragma optimize(none)
// your function here
#pragma optimize(speed) // size etc.
Hope that helps....