Implementing operand encoding function.