A bit change: #ifndef I -> #if !I
Reduced some lines.

Redoced some lines using a specification that undefined symbols
are evaluated to zero.
Reduced some lines by moving macro definitions.