Demo entry 6685794

eg1

   

Submitted by anonymous on Dec 21, 2017 at 11:14
Language: C. Code size: 237 Bytes.

short a;
short b;
short c;
short d;
short e;

// We want to get a=b*c+d*e;

// Wrong example
a = (b * c) >> 15 + (d * e) >> 15;
// a = (b * c >> (15 + d * e)) >> 15;

// Correct example
a = (b * c >> 15) + (d * e >> 15);

This snippet took 0.00 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).