Advertisement

Incrementing Pointers

Started by April 28, 2000 09:37 PM
34 comments, last by ziplux 24 years, 8 months ago
yes, do..while() loops can be faster.. good point
adamm@san.rr.com
It still doesn''t work, even after removing the "+ dx", so I''m still not sure what the problem is, it all seems OK. I''m creating all my surfaces in system memory and I''ve never had a problem with dividing by two to get the lPitch, so I don''t think that''s the problem. Once I get it working by incrementing the pointers, I''ll make your suggested cahnges (change from two dimensional array and only read from surface once.)

Visit our web site:
Asylum Entertainment
My Geekcode: "GCS d s: a14 C++$ P+(++) L+ E-- W+++$ K- w++(+++) O---- M-- Y-- PGP- t XR- tv+ b++ DI+(+++) D- G e* h!"Decode my geekcode!Geekcode.com
Visit our web site:Asylum Entertainment
Advertisement
I would test your code on my computer to find out what''s wrong, but I don''t know how your lookup table is set up :/

If you email me some source that I can build I''ll check it out...



adamm@san.rr.com
adamm@san.rr.com
by the way, how recent is that picture on your web page?

adamm@san.rr.com
adamm@san.rr.com
another thing:

if((*(dvidbuffer + index_x + dx) != colorkey))
should you be comparing the key against the source?


adamm@san.rr.com
adamm@san.rr.com
Hey check your mail now


adamm@san.rr.com
adamm@san.rr.com
Advertisement
I remember saying that instead of incrementing a pointer over the pixels, you should keep a pointer to the beginning of the row and index it.. to take advantage of some of the instructions of the pentium +...
but since your inner loop is so complex, I think the compiler would have a hard time keeping either of those values in a register all the way through, so on second though, it would probably be best to increment a pointer over them after all.

adamm@san.rr.com
adamm@san.rr.com
But fear not, it''s a simple change


adamm@san.rr.com
adamm@san.rr.com
char buf[128] = "Hello"
char *p = buf

now:

buf[0] is ''H''
*p is ''H''
p is (some bigass number)

p++;

now:
*p is ''e''
p is (another bigass number)

OK, I got your email. The file you sent me attached to the email is the exact same size as the main source file I orginally sent you. Are you sure you sent the right file?

Visit our web site:
Asylum Entertainment
My Geekcode: "GCS d s: a14 C++$ P+(++) L+ E-- W+++$ K- w++(+++) O---- M-- Y-- PGP- t XR- tv+ b++ DI+(+++) D- G e* h!"Decode my geekcode!Geekcode.com
Visit our web site:Asylum Entertainment

This topic is closed to new replies.

Advertisement