From 9b91aac48c1a4a8af8992c2332fddc8f698262d7 Mon Sep 17 00:00:00 2001 From: terminx Date: Sat, 22 Nov 2014 12:28:52 +0000 Subject: [PATCH] Inline krand() when not using KRANDDEBUG. DONT_BUILD. git-svn-id: https://svn.eduke32.com/eduke32@4744 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/build/include/build.h | 11 +++++++++++ polymer/eduke32/build/src/engine.c | 5 +---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/polymer/eduke32/build/include/build.h b/polymer/eduke32/build/include/build.h index ae91df311..295738189 100644 --- a/polymer/eduke32/build/include/build.h +++ b/polymer/eduke32/build/include/build.h @@ -1200,7 +1200,18 @@ extern const int16_t *chsecptr_onextwall; 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))); + +#if !KRANDDEBUG +FORCE_INLINE int32_t krand(void) +{ + // randomseed = (randomseed*27584621)+1; + randomseed = (randomseed * 1664525ul) + 221297ul; + return ((uint32_t) randomseed)>>16; +} +#else int32_t krand(void); +#endif + int32_t ksqrt(uint32_t num); int32_t __fastcall getangle(int32_t xvect, int32_t yvect); diff --git a/polymer/eduke32/build/src/engine.c b/polymer/eduke32/build/src/engine.c index b91558b04..b2eb72d1e 100644 --- a/polymer/eduke32/build/src/engine.c +++ b/polymer/eduke32/build/src/engine.c @@ -14358,8 +14358,6 @@ int32_t krd_print(const char *filename) fclose(fp); return 0; } -#endif // KRANDDEBUG - // // krand @@ -14369,17 +14367,16 @@ int32_t krand(void) // randomseed = (randomseed*27584621)+1; randomseed = (randomseed * 1664525ul) + 221297ul; -#if KRANDDEBUG if (krd_enabled) if (krd_numcalls < KRD_MAXCALLS) { backtrace(krd_fromwhere[krd_numcalls], KRD_DEPTH); krd_numcalls++; } -#endif return ((uint32_t)randomseed)>>16; } +#endif // KRANDDEBUG //