Click here to Skip to main content
11,490,003 members (50,043 online)
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C++ VC++
I am using the following function , for a image processing algorithm.

__m128i _mm_srli_si128 (__m128i a, int imm);

MSDN LINK[^]

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.

switch(imm)
 
{
 
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.
Posted 8-Oct-12 22:07pm
Edited 8-Oct-12 23:18pm
(no name)76.2K
v3
Comments
Jochen Arndt at 9-Oct-12 4:32am
   
I think there is no better solution than using a switch clause because imm is an immediate.
Vijay Sringeri at 11-Oct-12 1:31am
   
Hi,
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)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 610
1 Andy Lanng 233
2 OriginalGriff 208
3 Maciej Los 160
4 Sascha Lefèvre 160
0 Sergey Alexandrovich Kryukov 9,608
1 OriginalGriff 8,475
2 Sascha Lefèvre 3,419
3 Maciej Los 3,106
4 Richard Deeming 2,370


Advertise | Privacy | Mobile
Web03 | 2.8.150520.1 | Last Updated 9 Oct 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100