Jump to content
IGNORED

Skip sprite flag


Nop90

Recommended Posts

4 hours ago, karri said:

The reason is that off is defined as unsigned char.

 

Sure, the low level details are clear. But the real question is why it behaves that way. I'm not sure which standard cc65 tries to follow, but modern implementations in this scenario follow the rules of usual arithmetic conversions and integer promotions (§6.3.1.1):

 

image.thumb.png.f15b8c005073c65b275f088aba308296.png

 

Applying these ruses the "180-hoff" expression should have been calculated on ints and the result would be as expected.

That said and after some thinking I'm leaning towards conclusion that it's indeed not a bug but conscious decision to perform operations on smaller types due to performance reasons with accordance to §5.1.2.3:

 

image.thumb.png.2764b5695414521a13b71513e62104cb.png

 

...although in somewhat clumsy way.

 

So... if in doubts: use explicit casts and parentheses :)

Edited by laoo
  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...