simple if(!(r&0xFF)==PT_CFIR); (r&0xFF) is the element that is touching the particle in question. The ! is the not operator, so if the the element touching the particle is not PT_CFIR then perform the operation.
EDIT: Oh, not touching any particle but itself. if((r&0xFF)==PT_SELF || !(r&0xFF));