def encode_int(buffer: bytearray, position: int, length: int, value: int
    ) ->None:
    """
    Encode the integer value.

    :param buffer: Buffer to fill
    :param position: Start position
    :param length: Chunk length
    :param value: Value to encode
    :return: None
    """
    length -= 1
    position += length
    while length >= 0:
        buffer[position] = value % 10 + ord('0')
        value //= 10
        position -= 1
        length -= 1
