I have a function call that looks like this:
ltoserwrpad((result.counter_close[i]-result.counter_open[i]) * markers[i].value, 10);
the ltoserwpad function is declared like this:
void ltoserwrpad (s_long n, signed char width)
The struct variables is all u_short.
The problem is the following:
(0-1)*200 gives 65336, not -200.
This indicates to me that the intermediate result of the calculation is made using s_short?
How do I tell the compiler to widen the intermediate result to s_long in the calculation?
Cast one of the inner u_short's to s_long:
Log in to post a comment.