Generation

code to explanationThu, 08 Dec 2022

s16 shl(s16 var1,s16 var2) { s16 var_out; s32 resultat; if (var2 < 0) { var2 = -var2; var_out = shr(var1,var2); } else { resultat = (s32) var1 * ((s32) 1 << var2); if ((var2 > 15 && var1 != 0) || (resultat != (s32)((s16) resultat))) { gOverflow_flag = 1; var_out = (var1 > 0) ? MAX_16 : MIN_16; } else { var_out = extract_l(resultat); } } return(var_out); }

The function shl takes two arguments var1 and var2 and returns the result of shifting var1 by var2 bits to the left.

Want to kickstart your project?Use the new AI Studio to create your code