Encoder have a maximum value?

Hi, I'm having problems reading an optic encoder, it counts pulses just fine but when it gets to a certain value it resets from another pulse count, this is the code I'm using.

#define ENCA 2 // YELLOW
#define ENCB 3 // WHITE
volatile int posi = 0;

void setup() {
  Serial.begin(9600);
  pinMode(ENCA,INPUT);
  pinMode(ENCB,INPUT);
  attachInterrupt(digitalPinToInterrupt(ENCA),readEncoder,RISING);
}

void loop() {
  Serial.println(posi);
  
  }

void readEncoder(){
  int b = digitalRead(ENCB);
  if(b > 0){
    posi++;
  }
  else{
    posi--;
  }
}

I attached the encoder to a dc motor to try it, it has 430 pulses per revolution
and the serial plotter output is the following

it gets to 32743 and then it goes to the negative value, the motor its spinning only in one direction.

At what point does posi overflow ?
Check your data types.

Arduino data types and the ranges of values that they can hold.

Ooh thanks, i think thats it, i went to the page and for int it goes to the value i had, thanks for the help, gonna try it again with another data type