Which is the most efficient code in the below two, and why?
In the below code X123 can have values X0, X1, X2 and X3 only.
[\code]Code:switch(X123) { case 0: var1 = X0; break; case 1: var1 = X1; break; case 2: var1 = X2; break; case 3: var1 = X3; break; }
In the below code rewritten we use X[3] inatead of X0, X1...
Code:If (X123 <= 3) { var1= X[X123]; }