Staging: xgifb: Loop optimization.
PATCH 1/1 Staging: xgifb: Loop optimization.
Put operations involving loop constants outside
the loop.
Signed-off-by Navya Sri Nizamkari <[email protected]>
--- drivers/staging/xgifb/vb_setmode.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
drivers/staging/xgifb/vb_setmode.c +4 -5
@@ -1138,19 +1138,18 @@ static void XGI_LoadDAC(struct vb_device_info *pVBInfo) dl =0 ;for (n =0 ; n <3 ; n++) { + ah = table[di]; + al = table[bx];for (o =0 ; o <5 ; o++) { dh = table[si]; - ah = table[di]; - al = table[bx]; si++;XGI_WriteDAC (dl, ah, al, dh, pVBInfo); } si -=2 ; - + dh = table[bx]; + ah = table[di];for (o =0 ; o <3 ; o++) { - dh = table[bx]; - ah = table[di]; al = table[si]; si--;XGI_WriteDAC (dl, ah, al, dh, pVBInfo);
Signature · 1 line
1.9.1
Greg KH
maintainerQuoted 26 lines · Navya Sri Nizamkari
Put operations involving loop constants outside
the loop.Signed-off-by Navya Sri Nizamkari <[email protected]>--- drivers/staging/xgifb/vb_setmode.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)drivers/staging/xgifb/vb_setmode.c +2
-2@@ -1138,19 +1138,18 @@ static void XGI_LoadDAC(struct vb_device_info *pVBInfo) dl =0 ;for (n =0 ; n <3 ; n++) { + ah = table[di]; + al = table[bx];for (o =0 ; o <5 ; o++) { dh = table[si]; - ah = table[di]; - al = table[bx]; si++;XGI_WriteDAC (dl, ah, al, dh, pVBInfo); }
drivers/staging/xgifb/vb_setmode.c static void XGI_LoadDAC(struct vb_device_info *pVBInfo) · line 1155
Quoted 10 lines
drivers/staging/xgifb/vb_setmode.c +2
-3si -=2 ; - + dh = table[bx]; + ah = table[di];for (o =0 ; o <3 ; o++) { - dh = table[bx]; - ah = table[di]; al = table[si]; si--;XGI_WriteDAC (dl, ah, al, dh, pVBInfo);
Doesn't the compiler already do this?
Can you measure a difference here?
thanks,
greg k-h