[FFmpeg-devel] [PATCH 2/4] avcodec/xpm: Minor speed increase for mod_strcspn() {string, reject}==0

2021-02-25 Thread Jose Da Silva
Test string==0 once before looping. This avoids testing 'string!=0' i times inside the for i loop, (plus more checks for comments). Test reject==0 once before looping. This avoids testing 'reject!=0' i*[strlen(reject)+1] times inside the for j loop string. Signed-off-by: Jose Da Silva ---

Re: [FFmpeg-devel] [PATCH 2/4] avcodec/xpm: Minor speed increase for mod_strcspn() {string, reject}==0

2021-02-25 Thread Jose Da Silva
On February 24, 2021 05:56:17 AM Moritz Barsnick wrote: > On Mon, Feb 22, 2021 at 20:32:14 -0800, Jose Da Silva wrote: > > -for (i = 0; string && string[i]; i++) { > > +if (string == 0) > > "if (!string)" is the preferred style for pointers. Works for me. Updated patches reworked for

Re: [FFmpeg-devel] [PATCH 2/4] avcodec/xpm: Minor speed increase for mod_strcspn() {string, reject}==0

2021-02-24 Thread Moritz Barsnick
On Mon, Feb 22, 2021 at 20:32:14 -0800, Jose Da Silva wrote: > -for (i = 0; string && string[i]; i++) { > +if (string == 0) "if (!string)" is the preferred style for pointers. But I don't see the advantage - isn't the loop interrupted immediately anyway if string == NULL? (Same for the

[FFmpeg-devel] [PATCH 2/4] avcodec/xpm: Minor speed increase for mod_strcspn() {string, reject}==0

2021-02-22 Thread Jose Da Silva
Test string==0 once before looping. Avoid testing inside the loop. Test reject==0 once before looping. Avoid testing inside the loop. Signed-off-by: Jose Da Silva --- libavcodec/xpmdec.c | 14 -- 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/libavcodec/xpmdec.c