mirror of
https://github.com/cc65/cc65.git
synced 2024-12-27 15:29:46 +00:00
65 lines
831 B
C
65 lines
831 B
C
/*
|
|
!!DESCRIPTION!!
|
|
!!ORIGIN!! SDCC regression tests
|
|
!!LICENCE!! GPL, read COPYING.GPL
|
|
*/
|
|
|
|
#include <stdio.h>
|
|
#include <limits.h>
|
|
|
|
unsigned char success=0;
|
|
unsigned char failures=0;
|
|
unsigned char dummy=0;
|
|
|
|
unsigned char achar0 = 0;
|
|
unsigned char achar1 = 0;
|
|
unsigned char achar2 = 0;
|
|
|
|
void done()
|
|
{
|
|
dummy++;
|
|
}
|
|
|
|
void xor_chars_0_1(void)
|
|
{
|
|
achar2 = achar0 ^ achar1;
|
|
|
|
achar0 = achar0 ^ 0x1;
|
|
|
|
achar1 = achar0 ^ achar1 ^ 4;
|
|
}
|
|
|
|
void xor_if(void)
|
|
{
|
|
if(achar0 ^ achar1)
|
|
failures++;
|
|
|
|
achar0 ^= 0xff;
|
|
|
|
if( !(achar0 ^ achar1) )
|
|
failures++;
|
|
}
|
|
|
|
int main(void)
|
|
{
|
|
xor_chars_0_1();
|
|
|
|
if(achar2)
|
|
failures++;
|
|
|
|
if(achar0 != 1)
|
|
failures++;
|
|
|
|
if(achar1 != 5)
|
|
failures++;
|
|
|
|
achar0 = achar1;
|
|
xor_if();
|
|
|
|
success = failures;
|
|
done();
|
|
printf("failures: %d\n",failures);
|
|
|
|
return failures;
|
|
}
|