//some defines to get code to work or not work
//#define _WORK_


#ifdef MSP430 
#include <io.h>
#include "testing.h"
#else
#include <stdio.h>
#endif

unsigned char temp1 = 0x77;

void math (void) {

	/* Repeat for the high nibble in this byte. */
	temp1 += 0x30;
#ifndef _WORK_
	if (!(temp1 & 0x80)) 
#else
	if ((temp1 < 0x80)) 
#endif
	{
		temp1 -= 0x30;
	}

}

//for msp430-gcc
#ifdef MSP430  
int main(void) 
{

	TEST("TEST 1 add-check-compi\n");
	
	math();
	
	CHECK("temp1 + 3 to high nibble if >=5: \t", (temp1 & 0xf0) == 0xa0);
	CHECK("is the value still 0x77?: \t", (temp1) == 0x77);

	END_TEST;

}

//for gcc
#else
int main(void)
{
	math();
	printf ("temp1 after computation(should be 0xa7): %x\n", temp1);

	return 0;
}


#endif
