Although the savefile is the same, the bytecode is different: in the
latter case gen_dnhostop() generates 8 statements out of 20 with 16-bit
literal values byte-swapped, e.g.:
-(006) jeq #0x104 jt 22 jf 7
+(006) jeq #0x401 jt 22 jf 7
For one half of those statements the root cause is feeding the provided
16-bit big-endian DECnet address, which always needs to be converted to
little-endian to match the packet encoding, to ntohs(), which leaves the
value intact on a big-endian host. Fix this by using SWAPSHORT()
instead.
For the other half the root cause is treating two adjacent independent
bytes of the packet as a 16-bit value, hard-coding it and its 16-bit
mask byte-swapped and feeding these values to ntohs(), which on a
big-endian host does not cancel the hard-coded byte swap out. Fix this
by hard-coding the two bytes and the bit mask as big-endian in the first
place.
Remove a number of unnecessary type casts and add a comment to explain
the packet encoding and the code logic.