Performance improvements to pdPackage creation

Changes noted in source comments.  Also, this commit fixes the
endianness of the initial file marker, which of course means that all
previously created PDI files are now invalid.  :(  Sorry!