delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/09/02/23:00:51

Date: Tue, 2 Sep 1997 19:59:21 -0700 (PDT)
Message-Id: <199709030259.TAA10342@adit.ap.net>
Mime-Version: 1.0
To: djgpp AT delorie DOT com
From: Nate Eldredge <eldredge AT ap DOT net>
Subject: Optimization of math.h functions

Does anybody know why the math functions aren't implemented as inline
functions in the header file, but rather as regular functions? Since most of
them are just one or two instructions, it seems that making them available
as inline asm functions (like Allegro's _putpixel) would be much more
efficient. For starters, it would avoid storing local floating-point
variables from registers onto the stack, then reloading them within the
function.

At the very least, those to which it applies should have GCC's "const"
attribute applied to them to let the compiler optimize better.

If there's a disadvantage to this, somebody please let me know. Otherwise, I
think it should be done.

Nate Eldredge
eldredge AT ap DOT net



- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019