Results 1 to 10 of 34

Thread: BeRoPNG - A very tiny but complete PNG loader

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #14
    Still, you're swap32 function should be longword, not word, no?

    word and $FFFF0000 === 0 -- ALWAYS
    word shl 16 === 0 -- ALWAYS.

    So in effect:

    result:=(Swap16(x and $ffff) shl 16) or Swap16((x and $ffff0000) shr 16);

    is the same thing as saying

    result:=0;

    Which means on big-endian systems when your swap function is called, you'll get nothing but zero.

    Also, you're sending zero to your swap16 function...

    Code:
    function Swap32(x:longword):longword;
    begin
     result:=(Swap16(x and $ffff) shl 16) or Swap16(x shr 16);
    end;
    Is what you should have there. What you have right now won't work... Thankfully it's only called on big endian systems -- and you've probably only tested little endian.

    It may also need typecasting forced, since swap16 returns word, not longword meaning that shl 16 could STILL result in zero.
    Last edited by deathshadow; 27-08-2011 at 08:28 PM.
    The accessibility of a website from time to time must be refreshed with the blood of designers and owners. It is its natural manure

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •