[cc65] Unexpected behaviour with equality

From: Neil Stockbridge <cc651dist.ro>
Date: 2014-10-11 01:16:59
Hello,

I seem to be getting different results from an equality comparison
depending on whether the constant is on the left-hand side or not with
cc65 V2.13.3.

Here is an example that demonstrates the behaviour:

    #include <stdio.h>
    #include <stdint.h>

    #define  JOY_UP  1

    int main ( void)
    {
      uint8_t  joy_state = 0x7e;
      printf("bad: %u\n", 0 == (joy_state & 1) );
      printf("good: %u\n", (joy_state & 1) == 0 );

      return 0;
    }

This results in:

    bad: 0
    good: 1

Thanks very much for all of your hard work on cc65.  This is the most
fun I've had in years.

- neil

----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo@musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Sat Oct 11 01:27:08 2014

This archive was generated by hypermail 2.1.8 : 2014-10-11 01:27:10 CEST