Module: sems Branch: master Commit: 42e1d48a26b7dd18e33f1ea72f18bf2ca48e4fdb URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sems/?a=commit;h=42e1d48a26b7dd18e33f1ea72f18bf2ca48e4fdb
Author: Szókovács Róbert <[email protected]> Committer: Szókovács Róbert <[email protected]> Date: Wed Dec 4 14:12:37 2013 +0100 sip: optimized version of status_code_wr() --- core/sip/msg_fline.cpp | 15 ++++++--------- 1 files changed, 6 insertions(+), 9 deletions(-) diff --git a/core/sip/msg_fline.cpp b/core/sip/msg_fline.cpp index 87187b2..0ac50f0 100644 --- a/core/sip/msg_fline.cpp +++ b/core/sip/msg_fline.cpp @@ -31,18 +31,15 @@ #include "msg_fline.h" #include <assert.h> +#include <stdlib.h> inline void status_code_wr(char** c, int code) { - int div = code / 100; - *((*c)++) = div + '0'; - code -= div*100; - - div = code / 10; - *((*c)++) = div + '0'; - code -= div*10; - - *((*c)++) = code + '0'; + div_t d = div(code, 100); + *((*c)++) = d.quot + '0'; + d = div(d.rem, 10); + *((*c)++) = d.quot + '0'; + *((*c)++) = d.rem + '0'; } _______________________________________________ Semsdev mailing list [email protected] http://lists.iptel.org/mailman/listinfo/semsdev
