Implements the integer decoding function.