From 72b73f635621efc511b912d19c0d5eae50f6b615 Mon Sep 17 00:00:00 2001 From: helixhorned Date: Sun, 2 Sep 2012 14:12:01 +0000 Subject: [PATCH] Make getangle() a __fastcall function instead of static inline. This trims four 4k pages of code from the release EDuke32 build and one page from Mapster32. git-svn-id: https://svn.eduke32.com/eduke32@2991 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/build/include/build.h | 14 +------------- polymer/eduke32/build/src/engine.c | 11 +++++++++++ 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/polymer/eduke32/build/include/build.h b/polymer/eduke32/build/include/build.h index f0b2a8026..b2b8568a5 100644 --- a/polymer/eduke32/build/include/build.h +++ b/polymer/eduke32/build/include/build.h @@ -685,7 +685,7 @@ int32_t checksectorpointer(int16_t i, int16_t sectnum); void getmousevalues(int32_t *mousx, int32_t *mousy, int32_t *bstatus) ATTRIBUTE((nonnull(1,2,3))); int32_t krand(void); int32_t ksqrt(uint32_t num); -// int32_t getangle(int32_t xvect, int32_t yvect); +int32_t __fastcall getangle(int32_t xvect, int32_t yvect); // // getangle @@ -698,18 +698,6 @@ static inline uint32_t uhypsq(int32_t dx, int32_t dy) return (uint32_t)dx*dx + (uint32_t)dy*dy; } -static inline int32_t getangle(int32_t xvect, int32_t yvect) -{ - if ((xvect|yvect) == 0) return(0); - if (xvect == 0) return 512+((yvect<0)<<10); - if (yvect == 0) return ((xvect<0)<<10); - if (xvect == yvect) return 256+((xvect<0)<<10); - if (xvect == -yvect) return 768+((xvect>0)<<10); - if (klabs(xvect) > klabs(yvect)) - return ((radarang[640+scale(160,yvect,xvect)]>>6)+((xvect<0)<<10))&2047; - return ((radarang[640-scale(160,xvect,yvect)]>>6)+512+((yvect<0)<<10))&2047; -} - void rotatepoint(int32_t xpivot, int32_t ypivot, int32_t x, int32_t y, int16_t daang, int32_t *x2, int32_t *y2) ATTRIBUTE((nonnull(6,7))); int32_t lastwall(int16_t point); diff --git a/polymer/eduke32/build/src/engine.c b/polymer/eduke32/build/src/engine.c index 228e5215f..c594da6b3 100644 --- a/polymer/eduke32/build/src/engine.c +++ b/polymer/eduke32/build/src/engine.c @@ -11019,6 +11019,17 @@ int32_t inside(int32_t x, int32_t y, int16_t sectnum) return(cnt>>31); } +__fastcall int32_t getangle(int32_t xvect, int32_t yvect) +{ + if ((xvect|yvect) == 0) return(0); + if (xvect == 0) return 512+((yvect<0)<<10); + if (yvect == 0) return ((xvect<0)<<10); + if (xvect == yvect) return 256+((xvect<0)<<10); + if (xvect == -yvect) return 768+((xvect>0)<<10); + if (klabs(xvect) > klabs(yvect)) + return ((radarang[640+scale(160,yvect,xvect)]>>6)+((xvect<0)<<10))&2047; + return ((radarang[640-scale(160,xvect,yvect)]>>6)+512+((yvect<0)<<10))&2047; +} // // ksqrt