Integer Length for Intel Core 2 Duo (MAC OSX)

In summary, if your machine is 64 bit, you should be getting int64 instead of int32. If your compiler has a 64 bit compile option, this should be checked.
  • #1
cjm2176
8
0
Hello all,

I am trying to determine if my machine is 64 bit or 32 bit, according to this site:

http://support.apple.com/kb/ht3696"

the Intel Core 2 Duo I am using is 64 bit, but when I run the following code

Code:
#include <stdio.h>

int main(int argc, char **argv)
{
  char c;
  int  i;
  float f;
  double d;
  long l;
  long long ll;
 
  printf("char %ld, int %ld, long %ld, long long %ld, float %ld, double %ld, pointers %ld\n",
  8*sizeof(c),
  8*sizeof(i),
  8*sizeof(l),
  8*sizeof(ll),
  8*sizeof(f),
  8*sizeof(d),
  8*sizeof(&c));
}

I get the output:

char 8, int 32, long 32, long long 64, float 32, double 64, pointers 32

If my machine is 64 bit should I be getting int 64 instead of int 32? If yes could this be a problem? I am using GNU compilers, i.e. gcc.

Thanks
cjm2176
 
Last edited by a moderator:
Technology news on Phys.org
  • #2
No, int is 32 bits. long long int would be a 64 bit signed integer. or compile with the -m64 switch (or is it -arch x86_64 on mac? something like that)
 
Last edited:
  • #3
Ok thanks, are the other types the expected length for 64 bit? such as float and pointer?
 
  • #4
cjm2176 said:
Ok thanks, are the other types the expected length for 64 bit? such as float and pointer?
The code you showed has more to do with the code that the compiler generates than with the size of a register on your computer.

32 bits for a float is pretty standard and 64 bits for a double, which you didn't check. The fact that your compiler reports that a pointer is 32 bits makes me think that your compiler is generating 32-bit code.
 
  • #5
I tested your source code on Windows XP X64, using Microsoft Visual Studio (2005) in 64 bit mode, the only difference is that the pointers are 64 bit. Check to see if your compiler has a 64 bit compile option. For Visual Studio, the project build configuration has to be set to x64 to get 64 bit mode.
 

1. What is the integer length for Intel Core 2 Duo on MAC OSX?

The integer length for Intel Core 2 Duo on MAC OSX is 32 bits.

2. How does the integer length affect the performance of the processor?

The integer length affects the performance of the processor by determining the maximum size of integer values that can be processed at once. A longer integer length allows for larger values to be processed, which can improve the speed and efficiency of calculations.

3. Can the integer length be changed on Intel Core 2 Duo processors?

No, the integer length is determined by the hardware architecture of the processor and cannot be changed. It is a fixed value for Intel Core 2 Duo processors on MAC OSX.

4. How does the integer length for Intel Core 2 Duo compare to other processors?

The integer length for Intel Core 2 Duo is relatively short compared to newer processors such as Intel Core i5 and i7. These processors have 64-bit integer lengths, allowing for larger and more complex calculations to be performed.

5. Is the integer length the only factor that affects the performance of the processor?

No, there are many other factors that contribute to the overall performance of a processor, such as clock speed, cache size, and number of cores. The integer length is just one aspect that can impact the processor's performance.

Similar threads

  • Programming and Computer Science
Replies
4
Views
1K
  • Programming and Computer Science
Replies
7
Views
3K
  • Programming and Computer Science
Replies
5
Views
1K
  • Programming and Computer Science
Replies
5
Views
5K
  • Programming and Computer Science
Replies
7
Views
74K
  • Programming and Computer Science
Replies
5
Views
3K
  • Engineering and Comp Sci Homework Help
Replies
6
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
3
Views
4K
  • Engineering and Comp Sci Homework Help
Replies
0
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
0
Views
3K
Back
Top