RE: masks
You can look for PORT PIN (pale yellow) of Graynomad's Arduino Due pinout diagram as a reference.
So ,
uint32_t pin_17 = (1u << 12); // mask for pin 17
uint32_t pin_20 = (1u << 12); // mask for pin 20
Then the masks are the same, but in use they are applied to different ports?