Determine word size of my processor

后端 未结 8 1246
长发绾君心
长发绾君心 2020-11-28 08:26

How do I determine the word size of my CPU? If I understand correct an int should be one word right? I\'m not sure if I am correct.

So should just prin

相关标签:
8条回答
  • 2020-11-28 09:19

    What every may be the reason for knowing the size of the processor it don't matter.

    The size of the processor is the amount of date that Arthematic Logic Unit(ALU) of One CPU Core can work on at a single point of time. A CPU Cores's ALU will on Accumulator Register at any time. So, The size of a CPU in bits is the the size of Accumulator Register in bits.

    You can find the size of the accumulator from the data sheet of the processor or by writing a small assembly language program.

    Note that the effective usable size of Accumulator Register can change in some processors (like ARM) based on mode of operations (Thumb and ARM modes). That means the size of the processor will also change based on the mode for that processors.

    It common in many architectures to have virtual address pointer size and integer size same as accumulator size. It is only to take advantage of Accumulator Register in different processor operations but it is not a hard rule.

    0 讨论(0)
  • 2020-11-28 09:20

    an int should be one word right?

    As I understand it, that depends on the data size model. For an explanation for UNIX Systems, 64-bit and Data Size Neutrality. For example Linux 32-bit is ILP32, and Linux 64-bit is LP64. I am not sure about the difference across Window systems and versions, other than I believe all 32-bit Window systems are ILP32.

    How do I determine the word size of my CPU?

    That depends. Which version of C standard are you assuming. What platforms are we talking. Is this a compile or run time determination you're trying to make.

    The C header file <limits.h> may defines WORD_BIT and/or __WORDSIZE.

    0 讨论(0)
提交回复
热议问题