Severed bunny head
Register | User Profile | Member List | F.A.Q | Privacy Policy | New Blog | Search Forums | Forums Home
Doomworld Forums : Powered by vBulletin version 2.2.5 Doomworld Forums > Special Interest > Eternity > VC++ compile warnings
 
Author
All times are GMT. The time now is 08:11. Post New Thread    Post A Reply
Gez
Why don't I have a custom title by now?!


Posts: 11202
Registered: 07-07


These three warnings have been there for a while, so I suppose that maybe GCC doesn't catch them. They're all instances of purposefully exploiting 32-bit math overflow on angle_t values.
code:
1>.\source\r_main.c(248) : warning C4146: unary minus operator applied to unsigned type, result still unsigned 1>.\source\r_main.c(264) : warning C4146: unary minus operator applied to unsigned type, result still unsigned 1>.\source\r_bsp.c(1742) : warning C4146: unary minus operator applied to unsigned type, result still unsigned

The line numbers correspond to r830. The first two are the "octant 7" lines in R_PointToAngle and R_PointToAngle2, the third is in R_CheckBBox, the "angle2 = -clipangle" operation that happens after the check for whether it is "Totally off the left edge" or not.

Old Post 08-26-09 14:32 #
Gez is online now Profile || Blog || PM || Search || Add Buddy IP || Edit/Delete || Quote
Quasar
Moderator


Posts: 6085
Registered: 08-00


It is impossible to eliminate these warnings AFAIK. There is no valid portable idiom in C that will replace what these statements are trying to do to the best of my knowledge.

If you know of one, do share ;)

Old Post 08-27-09 16:03 #
Quasar is offline Profile || Blog || PM || Email || Homepage || Search || Add Buddy IP || Edit/Delete || Quote
exp(x)


Posts: 2595
Registered: 04-04


What about putting a 0 in front of the minus instead of using unary minus?

Old Post 08-27-09 16:47 #
exp(x) is offline Profile || Blog || PM || Email || Search || Add Buddy IP || Edit/Delete || Quote
Gez
Why don't I have a custom title by now?!


Posts: 11202
Registered: 07-07


Indeed, no warnings with lines modified as such:
code:
x > (y = 0-y) ? 0-tantoangle[SlopeDiv(y,x)] : // octant 7 angle2 = 0-clipangle;

Old Post 08-27-09 17:54 #
Gez is online now Profile || Blog || PM || Search || Add Buddy IP || Edit/Delete || Quote
Graf Zahl
Why don't I have a custom title by now?!


Posts: 7763
Registered: 01-03


That reminds me, is Eternity still using the Killoughized version of R_PointToAngle? Interestingly it's both far less readable and creates less efficient code than the original in Doom.exe...

That guy really had a problem with coding style. ;) What he did to these functions was just plain idiotic.

Old Post 08-27-09 20:14 #
Graf Zahl is online now Profile || Blog || PM || Email || Search || Add Buddy IP || Edit/Delete || Quote
Quasar
Moderator


Posts: 6085
Registered: 08-00


What do you know? Guess I never thought of that ;)

And yes it's still the Killoughized code simply because I never thought to revert it (a number of other such single-expression functions have been unwound through the years, though). Maybe now would be a good time to look into it :)

Old Post 08-28-09 00:03 #
Quasar is offline Profile || Blog || PM || Email || Homepage || Search || Add Buddy IP || Edit/Delete || Quote
exp(x)


Posts: 2595
Registered: 04-04



Quasar said:
What do you know? Guess I never thought of that ;)

Sometimes it's the simple solutions that escape us.

Old Post 08-28-09 00:16 #
exp(x) is offline Profile || Blog || PM || Email || Search || Add Buddy IP || Edit/Delete || Quote
Gez
Why don't I have a custom title by now?!


Posts: 11202
Registered: 07-07


Two new warnings in r839:
code:
1>.\source\p_cmd.c(350) : warning C4013: 'P_InitLightning' undefined; assuming extern returning int 1>.\source\p_cmd.c(355) : warning C4013: 'P_ForceLightning' undefined; assuming extern returning int

Old Post 08-31-09 14:06 #
Gez is online now Profile || Blog || PM || Search || Add Buddy IP || Edit/Delete || Quote
exp(x)


Posts: 2595
Registered: 04-04


Try including p_anim.h in p_cmd.c

Old Post 08-31-09 16:26 #
exp(x) is offline Profile || Blog || PM || Email || Search || Add Buddy IP || Edit/Delete || Quote
Quasar
Moderator


Posts: 6085
Registered: 08-00


Guys you gotta give me more than 5 minutes after a commit to catch stuff like that ;) I appreciate the thought and effort, just don't go overboard ^_^

Old Post 08-31-09 18:34 #
Quasar is offline Profile || Blog || PM || Email || Homepage || Search || Add Buddy IP || Edit/Delete || Quote
exp(x)


Posts: 2595
Registered: 04-04


I blame him.

Old Post 08-31-09 20:12 #
exp(x) is offline Profile || Blog || PM || Email || Search || Add Buddy IP || Edit/Delete || Quote
Creaphis
I will deliberately take a contrary position just for the sake of writing incredibly long arguments


Posts: 4181
Registered: 10-05


Shame on you Quasar.

Old Post 08-31-09 20:16 #
Creaphis is offline Profile || Blog || PM || Email || Search || Add Buddy IP || Edit/Delete || Quote
entryway
Forum Staple


Posts: 2733
Registered: 01-04



Graf Zahl said:
That reminds me, is Eternity still using the Killoughized version of R_PointToAngle? Interestingly it's both far less readable and creates less efficient code than the original in Doom.exe...


not so much though :)

code:
unsigned int i, k, tic; tic = SDL_GetTicks(); for(i = 0; i < 1e8; i++) { k += R_PointToAngle(k, i); } I_Error("%d %d", SDL_GetTicks() - tic, k);


~1412 msec for Boom
~1374 msec for Carmack

So you can save ~0.04 sec with 100 billions of PointToAngle

btw, zdoom version (which is not used, but code is there) is 1710 msec - much slower. Used (precise) version of course is super slow - 8140 msec.

Last edited by entryway on 09-08-09 at 19:55

Old Post 09-08-09 19:36 #
entryway is online now Profile || Blog || PM || Homepage || Search || Add Buddy IP || Edit/Delete || Quote
Gez
Why don't I have a custom title by now?!


Posts: 11202
Registered: 07-07


Now see what you've done.

Old Post 09-09-09 09:32 #
Gez is online now Profile || Blog || PM || Search || Add Buddy IP || Edit/Delete || Quote
entryway
Forum Staple


Posts: 2733
Registered: 01-04



Gez said:
Now see what you've done.

Did not know zdoom uses that code, because gzdoom uses atan2 in both renderers.

Old Post 09-09-09 10:04 #
entryway is online now Profile || Blog || PM || Homepage || Search || Add Buddy IP || Edit/Delete || Quote
All times are GMT. The time now is 08:11. Post New Thread    Post A Reply
 
Doomworld Forums : Powered by vBulletin version 2.2.5 Doomworld Forums > Special Interest > Eternity > VC++ compile warnings

Show Printable Version | Email this Page | Subscribe to this Thread

 

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are OFF
[IMG] code is ON
 

< Contact Us - Doomworld >

Powered by: vBulletin Version 2.2.5
Copyright ©2000, 2001, Jelsoft Enterprises Limited.