public static void signExtend(final long offset,final ITranslationEnvironment environment,final IInstruction instruction,final List<ReilInstruction> instructions,final OperandSize firstOperandSize,final String firstOperand,final OperandSize resultOperandSize,final String resultOperand,final int size){
  final OperandSize dw=OperandSize.DWORD;
  String fMask="";
  String eightMask="";
  final String tmpVar1=environment.getNextVariableString();
  final String tmpVar2=environment.getNextVariableString();
  if (size == 8) {
    fMask=String.valueOf(0xFFL);
    eightMask=String.valueOf(0x80L);
  }
 else   if (size == 16) {
    fMask=String.valueOf(0xFFFFL);
    eightMask=String.valueOf(0x8000L);
  }
 else {
    fMask=String.valueOf(0xFFFFFFFFL);
    eightMask=String.valueOf(0x80000000L);
  }
  long baseOffset=offset;
  instructions.add(ReilHelpers.createAdd(baseOffset++,firstOperandSize,firstOperand,dw,eightMask,dw,tmpVar1));
  instructions.add(ReilHelpers.createAnd(baseOffset++,dw,tmpVar1,dw,fMask,dw,tmpVar2));
  instructions.add(ReilHelpers.createSub(baseOffset++,dw,tmpVar2,dw,eightMask,resultOperandSize,resultOperand));
}

public static void signExtend ( final long offset , final ITranslationEnvironment environment , final IInstruction instruction , final List < ReilInstruction > instructions , final OperandSize firstOperandSize , final String firstOperand , final OperandSize resultOperandSize , final String resultOperand , final int size ) { final OperandSize dw = OperandSize . DWORD ; String fMask = "" ; String eightMask = "" ; final String tmpVar1 = environment . getNextVariableString ( ) ; final String tmpVar2 = environment . getNextVariableString ( ) ; if ( size == 8 ) { fMask = String . valueOf ( 0xFFL ) ; eightMask = String . valueOf ( 0x80L ) ; } else if ( size == 16 ) { fMask = String . valueOf ( 0xFFFFL ) ; eightMask = String . valueOf ( 0x8000L ) ; } else { fMask = String . valueOf ( 0xFFFFFFFFL ) ; eightMask = String . valueOf ( 0x80000000L ) ; } long baseOffset = offset ; instructions . add ( ReilHelpers . createAdd ( baseOffset ++ , firstOperandSize , firstOperand , dw , eightMask , dw , tmpVar1 ) ) ; instructions . add ( ReilHelpers . createAnd ( baseOffset ++ , dw , tmpVar1 , dw , fMask , dw , tmpVar2 ) ) ; instructions . add ( ReilHelpers . createSub ( baseOffset ++ , dw , tmpVar2 , dw , eightMask , resultOperandSize , resultOperand ) ) ; }
sign extend 8 , 16 , 32 bit registers
