Click here to Skip to main content
15,669,603 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am using the following function , for a image processing algorithm.

__m128i _mm_srli_si128 (__m128i a, int imm);


imm -> is a compile time constant.. ( 0, 1, 2 ......)

But, I would be calculating "imm" at run time only, and I can have any values from " 1 to 20 " which means.. I would to duplicate the same "function call" for different values of "imm" ... something like this.



case 1 : __m128i _mm_srli_si128 (__m128i a, 1);

break ;

case 2 : __m128i _mm_srli_si128 (__m128i a, 2);

break ;

case 3 : __m128i _mm_srli_si128 (__m128i a, 3);

break ;

/* this redundant code has to be written for 20 times !!!! */


How can I get-around this problem, Please help.
Updated 8-Oct-12 22:18pm
Jochen Arndt 9-Oct-12 4:32am    
I think there is no better solution than using a switch clause because imm is an immediate.
Vijay Rajanna 11-Oct-12 1:31am    
Thanks for the info, yes even I learnt that there is no other way to handle it better.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900