This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
The moose likes General Computing and the fly likes 32 bit and 64 bit systems Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Engineering » General Computing
Bookmark "32 bit and 64 bit systems" Watch "32 bit and 64 bit systems" New topic
Author

32 bit and 64 bit systems

nirjari patel
Ranch Hand

Joined: Apr 23, 2009
Posts: 374
1 byte is composed of 8 bits. Thats the legacy.

Now for the newer systems of 32 bits and 64 bits, is byte size still 8 bit or is 1 byte equal to 32 bits in 32 bit system and 64 bits in g4 bit system ?

So when we declare integer in 32 bit system is it 1 byte (32 bits) or 4 bytes (8 bits) ?

How does it work with 64 bit system ?

Thanks
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42047
    
  64
1 byte is always 8 bits.

How many bits an "integer" data type comprises depends on the language in question. In Java, an "int" always has 32 bits, and a "long" 64 bit. That's independent of whether the underlying system has 32 bit hardware or 64 bit hardware.


Ping & DNS - my free Android networking tools app
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5836
    
    7

Or even if the hardware is 48 bits!


JBoss In Action
nirjari patel
Ranch Hand

Joined: Apr 23, 2009
Posts: 374
1 byte is always 8 bits.

How many bits an "integer" data type comprises depends on the language in question. In Java, an "int" always has 32 bits, and a "long" 64 bit. That's independent of whether the underlying system has 32 bit hardware or 64 bit hardware.
Thanks.

I was confused that 32 bit and 64 bits are the sizes for byte in newer systems. Then what does 32 bit and 64 bit system indicate ? What 32 and 64 bits indicate ? Which component do they refer to ?

Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 18876
    
  40

nirjari patel wrote: Thanks.

I was confused that 32 bit and 64 bits are the sizes for byte in newer systems. Then what does 32 bit and 64 bit system indicate ? What 32 and 64 bits indicate ? Which component do they refer to ?


In processor speak, a 64 bit system has a 64 bit bus, with 64 bit registers, and has instructions that can operate on those 64 bit registers. So, as an example (let's say in C), if you try to add two long values, the C compiler can generate a single instruction for that operation on a 64 bit environment. For a 32 bit environment, the compiler would generate code that operate on the 64 bit long variable, 32 bits at a time, dealing with the carry, etc. in order to perform the same operation. This means that the 32 bit generated code is longer (has lots more instructions) and of course, will take longer to run.

Henry


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
 
GeeCON Prague 2014
 
subject: 32 bit and 64 bit systems