Re: Data Types



Erik Mouw wrote:
> On Fri, May 25, 2001 at 01:19:20PM +1000, Helmethead wrote:

> > If ints are 64 bits, how do you get 32 and 16 bit vars? Are 64 bit architectures missing one of these?
> 
> Yes, because all 64 bit CPUs I know are RISC CPUs, they don't like
> anything else then their native format. So 64 bit CPUs want 64 bit
> variables (int is 64 bit), and 32 bit machines want 32 bit variables.

I don't think this is correct. 64-bit code is in general slower than
32-bit code. The only exception that comes to my mind are programs which
perform a lot of 64-bit integer arithmetic. And there aren't many of them
around.

Even Alpha code would be faster with 32-bit pointers. Alpha is sort of
an exception here, because there wasn't 32-bit Alpha, so there wasn't
installed code base to be compatible with. The reason for having only
64-bit environment on Alpha systems was simplicity: so that noone would
have to deal with multiple environments. I think it was a good trade-off.

But you can have 32-bit pointers on Digital Unix or Tru64 and that code
would run faster.

> Most ABIs however do allow the user to use smaller than native integer
> formats, but at a big price: the compiler has to generate special code
> to access those variables (especially if they are not aligned) which
> makes the program horribly slow.

Accessing non-aligned data hits even if you are dealing with 64-bit
variables. Accessing (aligned) smaller integer types shouldn't come
with any additional cost.

-- 
 .-.   .-.    Sarcasm is just one more service we offer.
(_  \ /  _)
     |        dave arsdigita com
     |




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]