I have different variables and I want to have a final variable that represents the concatenation of those variables by taking a specific number of bits from each variable. For example, if I have 3 variables var1, var2 and var3 and I want to take 3, 2 and 1 bits respectively from each variable, the final result will be:
uint32 var1 = 11; //1011 int32 var2 = 5 /*0101*/, var3 = 3 /*011*/; uint final_var; ... final_var = 011011; // 011 from var1 + 01 from var2 + 1 from var3
My variables are int and unsigned int and my final variable will be always uint32.
Thank you in advance.