delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2001/02/04/05:41:56

From: lauras AT softhome DOT net
Message-ID: <20010204104132.7148.qmail@softhome.net>
References: <Pine DOT SUN DOT 3 DOT 91 DOT 1010204095531 DOT 20547S-100000 AT is>
In-Reply-To: <Pine.SUN.3.91.1010204095531.20547S-100000@is>
To: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
Cc: djgpp-workers AT delorie DOT com
Subject: Re: stdint.h
Date: Sun, 04 Feb 2001 10:41:32 GMT
Mime-Version: 1.0
X-Sender: lauras AT softhome DOT net
Reply-To: djgpp-workers AT delorie DOT com

Eli Zaretskii writes:
> However, I didn't find any evidence that an int is faster than a char.  
> Can you provide such an evidence, e.g., by looking at the code produced 
> by gcc 2.9X and counting cycles?

I tried. I was wrong - the difference between two versions is very little.

Here is my "benchmark":

int main(void)
{
   unsigned char x, y, z, t, u, v;
   for (x = 0; x < 200; x++)
      for (y = 0; y < 200; y++)
         for (u = 0; u < 200; u++)
            for (v = 0; v < 200; v++)
            {
               z = x * y;
               t = z - x / y;
               z = t + u; 
               t = z - u;
            }
   return 0;
}

Replace 'unsigned char' with 'unsigned int' for int version.

> > > +typedef signed int int_fast16_t;
> > > +typedef unsigned int uint_fast16_t;
> > 
> > Likewise there.
> 
> Well, these _are_ 32-bit int's, aren't they? ;-)

Ooops. I swear I saw 'short int' there :-)

Laurynas


- Raw text -


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