Domanda sugli ATmega, bit di interrupt

Sì, è vero. Mi era sfuggito questo punto.
Se ti può interessare, ho letto questo modo di fare anche da altre parti.
Ad esempio, datasheet del 328, pag. 74:

Bit 1 – INTF1: External Interrupt Flag 1
When an edge or logic change on the INT1 pin triggers an interrupt request, INTF1 becomes set
(one). If the I-bit in SREG and the INT1 bit in EIMSK are set (one), the MCU will jump to the cor-
responding Interrupt Vector. The flag is cleared when the interrupt routine is executed.
Alternatively, the flag can be cleared by writing a logical one to it. This flag is always cleared
when INT1 is configured as a level interrupt.

• Bit 0 – INTF0: External Interrupt Flag 0
When an edge or logic change on the INT0 pin triggers an interrupt request, INTF0 becomes set
(one). If the I-bit in SREG and the INT0 bit in EIMSK are set (one), the MCU will jump to the cor-
responding Interrupt Vector. The flag is cleared when the interrupt routine is executed.
Alternatively, the flag can be cleared by writing a logical one to it. This flag is always cleared
when INT0 is configured as a level interrupt.

Ed è scritto anche in tutte le pagine seguenti.
Mi viene da pensare che la scrittura non sia diretta ma che venga fatto uno XOR col valore precedentemente contenuto nel bit. Per attivare il flag, se fai lo XOR fra il contenuto 0 ed il valore 1 ottieni 1: 0 XOR 1 = 1.
Se però rifai lo XOR con 1, ottieni 0: 1 XOR 1 = 0. Quindi forse per evitare più operazioni per modificare il bit, venga fatto uno XOR senza controllare il suo stato.
Senza, per attivare il flag, si dovrebbe fare:

  1. carica il valore del registro
  2. if bit è a 0? sì: mettilo a 1;
  3. no: mettilo a 0.
  4. riscrivi il resistro.
    Con lo XOR, i punti 2 e 3 diventano uno solo:
  5. carica il valore del registro
  6. fai lo XOR con 1 del bit corrispondente
  7. riscrivi il registro

So che può essere una motivazione del ca@@o ma io non ho fatto l'uni e ragiono solo per "logica", cercando di pensare ad un motivo plausibile per questo comportamento.