Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Question to 64 bit experts

Author: Dann Corbit

Date: 12:17:15 01/19/05

Go up one level in this thread


On January 19, 2005 at 11:55:43, RĂ©mi Coulom wrote:

>Hi,
>
>I am porting my chess program to 64 bit on an AMD64 Athlon processor. I have
>noticed that, with gcc, sizeof(int)=4. I would have expected sizeof(int)=8. On
>32-bit platforms, 32-bit variables are faster than 16-bit variables. I wonder if
>64-bit variables are faster than 32-bit variables on 64-bit machines. I have
>made a few experiments and did not notice much difference.

It was the original intention for the C language to use int as the fastest
integer type.  That has gone by the wayside for some reason.  However, there are
new hints in the C99 spec for fast types that some compilers should support.

From the ANSI/ISO C99 Standard:

7.18.1.3 Fastest minimum-width integer types
1 Each of the following types designates an integer type that is usually fastest
2 The typedef name int_fastN_t designates the fastest signed integer type with a
width of at least N. The typedef name uint_fastN_t designates the fastest
unsigned integer type with a width of at least N. [see: footnote 216]
3 The following types are required:
int_fast8_t
int_fast16_t
int_fast32_t
int_fast64_t
uint_fast8_t
uint_fast16_t
uint_fast32_t
uint_fast64_t
All other types of this form are optional.

footnote 216: The designated type is not guaranteed to be fastest for all
purposes; if the implementation has no clear grounds for choosing one type over
another, it will simply pick some integer type satisfying the signedness and
width requirements.



This page took 0 seconds to execute

Last modified: Thu, 15 Apr 21 08:11:13 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.