Посмотрите на это в двоичном виде.
1d (ecimal) = 001b (inary)
4d (ecimal) = 100b (inary)
* Таким образом, 1007 *
001b
100b & (both bits have to be 1 to yield 1)
--
000b = 0d
и
001b
100b | (only one on either side (or both) has to be 1 to yield 1)
--
101b = 5d