Hi,

While poking around in the sip directory, I noticed that the stack uses
an optimized function to render the SIP code to the answer string. I
think we can do even better, using the div() function that computes the
quotient and the remainder in a single call (which usually a single CPU
instruction as well), so I propose this new version:

inline void status_code_wr(char** c, int code)
{
    div_t d = div(code, 100);
    *((*c)++) = d.quot + '0';
    d = div(d.rem, 10);
    *((*c)++) = d.quot + '0';
    *((*c)++) = d.rem + '0';
}

If there's no objection, I'll commit it to the master.

br

Szo
_______________________________________________
Semsdev mailing list
[email protected]
http://lists.iptel.org/mailman/listinfo/semsdev

Reply via email to