Jump to content
Sign in to follow this  

What Is Sourceboost Mulriplication Behavior?

Recommended Posts

What is source boost Multiplication behavior anybody??


unsigned char seg1 = 10;

unsigned short seg2 = 4000;

unsigned short seg3 = 2000;

unsigned short segresult = seg1 * seg2 / seg3;


does seg1 * seg2 result is always 16bit and then this is divided by seg3 which is 16bit..

is seg1 which is 8bit gets converted first to 16bit before multiplying.. if so wouldnt it be better if i just make seg1 also 16bit to avoid convertion..


see I'm trying to find out which one will make the code smaller and better..

anybody know...


Share this post

Link to post
Share on other sites

I don't know the answer but you could easily find out by making a tiny project with just the equations that you are interested in and examining the code that is generated. As you never really know for sure what will happen until you experiment.

Share this post

Link to post
Share on other sites

Join the conversation

You are posting as a guest. 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.

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.

Sign in to follow this  

  • Create New...