Class.c

From: Dante Mavec (bumster@paci-labs.com)
Date: 06/19/02


While poking around class.c I found a comment that implied that a huge set of switches like this:

switch (GET_CLASS(ch))
{
case (CLASS_WARRIOR)
{
switch(GET_LEVEL(ch))
case 0: return 90;
case 1: return 87;

etc etc etc is faster (processor-wise) than something like " return (100 - (GET_LEVEL(ch) * 1.5)) "

I'd be inclined to say that this isn't the case...  the second way of doing it is one calculation, whereas the latter could have to make 20 or so comparisions between GET_LEVEL(ch) and a number before finding the right value.

Firstly, does the second actually use more juice?
Secondly, if it does, is it an appreciable amount?

Thankyou,
 - Dante

--
   +---------------------------------------------------------------+
   | FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html |
   | Archives: http://post.queensu.ca/listserv/wwwarch/circle.html |
   | Newbie List:  http://groups.yahoo.com/group/circle-newbies/   |
   +---------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 06/25/03 PDT