MEGA 2560 interrupt question

I am using two gearbox motors with encoder. To read the encoder counts, pin18 and pin19 are attached to interrupt. The following is my codes. But it does not work, the valid CPR should be 120, while the serial output value is 0.0.

Please tell me how to fix the codes. Thank you.

const int LeftEncoderA = 18;
const int LeftEncoderB = 22;

const int RightEncoderA = 19;
const int RightEncoderB = 23;

volatile long leftCounter = 0;
volatile long rightCounter = 0;

void setup()
  pinMode(LeftEncoderA, INPUT);
  pinMode(LeftEncoderB, INPUT);
  attachInterrupt(5, leftEncoder, CHANGE);
  pinMode(RightEncoderA, INPUT);
  pinMode(RightEncoderB, INPUT);
  attachInterrupt(4, rightEncoder, CHANGE);

void loop(void)

void leftEncoder() 
  if ((bool)(PIND & _BV(PD3)) == (bool)(PINA & _BV(PA0))) // read pin 18 and pin 22

void rightEncoder() 
  if ((bool)(PIND & _BV(PD2)) == (bool)(PINA & _BV(PA1))) // read pin 19 and pin 23

Where are macros like _BV, PIND, PA0 defined? I get to know the symbols from MEGA 2560 Pin Mapping,

The first is defined in the arduino core as:

#define _BV(p) (1<<(p))

In otherwords, at compile time, anything which says _BV(some number) will be replaced by (1<<some number).

The other two are defined in the AVR core as the correct registers and pin bits.

Boolean variables still take up a byte, so by type casting them to bool, they still wont be equal (unless they are both 0). Whay you need to do is shift the result of (PIND & _BV(PD3)) and of they other down so that the position of the bit positions of the two statments match.

The arduino core contains bitRead() which is a macro that does just that:

#define bitRead(value, bit) (((value) >> (bit)) & 0x01)

So you would do this:

if (bitRead(PIND,PD3) == bitRead(PINA,PA0)) // read pin 18 and pin 22

which at compile time would be replaced by:
if (((PIND>>PD3) & 0x01) == ((PINA>>PA0) & 0x01))
which is then further replaced by:

if (((_SFR_IO8(0x09)>>3) & 0x01) == ((_SFR_IO8(0x00)>>0) & 0x01))

Thank you, Tom.
It is very detailed and I become understand these operations.