these operations takes eight instructions. But on most machines these are probably no better than the straightforward C code shown below, which executes in four to six instructions for small a, b, and c. Pursuing this matter, there is an ingenious branch-free method of cycling among three values on machines that do not have comparison predicate instruc- tions [GLS1]. It executes in eight instructions on most machines. Because a, b, and c are distinct, there are two bit positions and where the bits of a, b, and c are not all the same, and where the “odd one out” (the one whose bit differs in that position from the other two) is different in positions and This is illustrated below for the values 21, 31, and 20, shown in binary. Without loss of generality, rename a, b, and c so that a has the odd one out in position and b has the odd one out in position as shown above. Then there are two possibilities for the values of the bits at position namely = (0, 1, 1) or (1, 0, 0). Similarly, there are two possibilities for the bits at position namely = (0, 1, 0) or (1, 0, 1). This makes four cases in all, and formulas for each of these cases are shown below. Case 1, = (0, 1, 1), = (0, 1, 0): Case 2, = (0, 1, 1), = (1, 0, 1): Case 3, = (1, 0, 0), = (0, 1, 0): Case 4, = (1, 0, 0), = (1, 0, 1): if (x == a) x = b; else if (x == b) x = c; else x = a; n1 n2 n1 n2 . 1 0 1 0 1 c 1 1 1 1 1 a 1 0 1 0 0 b n1 n2 n1 n2 , n1 , an1 bn1 cn1 , , ( ) n2 , an2 bn2 cn2 , , ( ) an1 bn1 cn1 , , ( ) an2 bn2 cn2 , , ( ) f x ( ) xn1 a b – ( ) * xn2 c a – ( ) * b. + + = an1 bn1 cn1 , , ( ) an2 bn2 cn2 , , ( ) f x ( ) xn1 a b – ( ) * xn2 a c – ( ) * b c a – + ( ). + + = an1 bn1 cn1 , , ( ) an2 bn2 cn2 , , ( ) f x ( ) xn1 b a – ( ) * xn2 c a – ( ) * a. + + = an1 bn1 cn1 , , ( ) an2 bn2 cn2 , , ( ) f x ( ) xn1 b a – ( ) * xn2 a c – ( ) * c. + + =