CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

Is this a bug or...?

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Matte
Guest







Is this a bug or...?
PostPosted: Sat Mar 05, 2005 2:38 pm     Reply with quote

This code works fine with 3.156
Code:
LcdD4 = n & 1; // Lcd4 is a int1, n is a int8

it failed with version ???
but i do know it failed with 3.190 and later

I put this code to work it out now
Code:
if(n & 1) LcdD4 = 1; else LcdD4 = 0;

Confused
Ttelmah
Guest







PostPosted: Sat Mar 05, 2005 3:08 pm     Reply with quote

This was reported at the time. It was a deliberate change, apparently to actually bring the compiler closer to ANSI in some way, but it results in arithmetic, that doesn't happen to 'hit' the bit used by an int1, resulting in a false. Use:
LcdD4=((n&1)!=0).
This should result in a faster version than the if test.

Best Wishes
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group