Forgot about this thread... but:
function Swap32(x:word):word;
word is 16 bit unsigned... can only contain 0..$FFFF -- therein:
x and $ffff returns X
x and $ffff0000 returns 0, always...
since $FFFF is the highest number WORD can contain, $0000FFFF and $FFFF0000 == 0, ALWAYS. X in your function CANNOT hold a value that would return anything but zero on that second AND.... EVER.
See what I'm saying? for that function to work X would have to be DWORD and/or Longint... 32 bit... not 16 bit which is what WORD is.
Bookmarks