| ??? 02/14/01 15:07 Read: times |
#9317 - RE: use of multiply in large data arrays |
Erik thanks,
I have written a little test, switch (U_MsgHndl_Box) { case 1: P_Pointer = &PCcommBuffer[1 * MsgBoxSize]; break; case 2: P_Pointer = &PCcommBuffer[2 * MsgBoxSize]; break; case 3: P_Pointer = &PCcommBuffer[3 * MsgBoxSize]; break; } *P_Pointer = 0x02; The next code is produced when i use #pragma jump_switch /* force jump table code */ ; p_msghndl.c 623 switch (U_MsgHndl_Box) ?LINE 623 MOV A,_53 DEC A CJNE A,#03H,_58 _58: JNC _49 MOV DPTR,#_52 MOV R2,A ADD A,R2 ADD A,R2 JMP @A+DPTR ; p_msghndl.c 624 { ; p_msghndl.c 625 case 1: ?LINE 625 _44: ; p_msghndl.c 626 P_Pointer = &PCcommBuffer[1 * MsgBoxSize]; ?LINE 626 MOV DPTR,#_57 MOV A,# HIGH (_PCcommBuffer+17) MOVX @DPTR,A MOV A,# LOW (_PCcommBuffer+17) INC DPTR MOVX @DPTR,A ; p_msghndl.c 627 break; ?LINE 627 SJMP _49 ; p_msghndl.c 628 ; p_msghndl.c 629 case 2: ?LINE 629 _45: ; p_msghndl.c 630 P_Pointer = &PCcommBuffer[2 * MsgBoxSize]; ?LINE 630 MOV DPTR,#_57 MOV A,# HIGH (_PCcommBuffer+34) MOVX @DPTR,A MOV A,# LOW (_PCcommBuffer+34) INC DPTR MOVX @DPTR,A ; p_msghndl.c 631 break; ?LINE 631 SJMP _49 ; p_msghndl.c 632 ; p_msghndl.c 633 case 3: ?LINE 633 _46: ; p_msghndl.c 634 P_Pointer = &PCcommBuffer[3 * MsgBoxSize]; ?LINE 634 MOV DPTR,#_57 MOV A,# HIGH (_PCcommBuffer+51) MOVX @DPTR,A MOV A,# LOW (_PCcommBuffer+51) INC DPTR MOVX @DPTR,A ; p_msghndl.c 635 break; ; p_msghndl.c 636 ; p_msghndl.c 637 } ?LINE 637 _49: ; p_msghndl.c 638 ; p_msghndl.c 639 *P_Pointer = 0x02; ?LINE 639 MOV DPTR,#_57 MOVX A,@DPTR MOV R2,A INC DPTR MOVX A,@DPTR MOV DPL,A MOV DPH,R2 MOV A,#02H MOVX @DPTR,A As you see it could be more efficient. Think I'll take the assembler wat or try to configure my compiler "BSO Tasking" to do it more straight. Now I will kiss my wife. See you tomorrow Patrick |



