Changes

Jump to: navigation, search

Quad Word

3,438 bytes added, 17:22, 25 May 2018
Created page with "'''Home * Programming * Data * Quad Word''' According to Intel's definition of a x86 16-bit Word, a '''Quad Word''' refers a 64-bit wo..."
'''[[Main Page|Home]] * [[Programming]] * [[Data]] * Quad Word'''

According to [[Intel|Intel's]] definition of a [[x86]] 16-bit [[Word]], a '''Quad Word''' refers a 64-bit word.

=long long or long=
Microsoft 64-bit [[C]]-compiler long is still 32-bit [[Double Word]], while 64-bit [[Free Software Foundation#GCC|GCC]] uses 64-bit Quad Words as longs. Other compiler require "long long" for 64-bit types.

<pre>
typedef unsigned long QWORD;
typedef unsigned long long QWORD;
</pre>

=Bitboards=
Quad words are used as [[Bitboards|bitboard]] datatype:
<pre>
typedef QWORD U64;
typedef QWORD Bitboard;
</pre>

=Ranges=
{| class="wikitable"
|-
! language
! type
! min
! max
|-
| rowspan="2" | [[C]], [[Cpp|C++]]
| unsigned long long
| style="text-align:right;" | 0
| style="text-align:right;" | 18,446,744,073,709,551,615
|-
| hexadecimal
| style="text-align:right;" | 0x0000000000000000
| style="text-align:right;" | 0xFFFFFFFFFFFFFFFF
|-
| rowspan="2" | [[C]], [[Cpp|C++]],<br/>[[Java]]
| long long
| style="text-align:right;" | -9,223,372,036,854,775,808
| style="text-align:right;" | 9,223,372,036,854,775,807
|-
| hexadecimal
| style="text-align:right;" | 0x8000000000000000
| style="text-align:right;" | 0x7FFFFFFFFFFFFFFF
|}

=Alignment=
Quad Words stored in memory should be stored at byte addresses divisible by eight. Otherwise at runtime it will cause a miss-alignment exception on some processors, or a huge penalty on others.

=Endianness=
''Main article: [[Endianness]].''

==Litte-endian Layout==
The [[Little-endian|little-endian]] memory layout, as typical for [[Intel]] cpus.
For instance the quad word integer 0x0102030405060708
{| class="wikitable"
|-
! Address
! Byte
! Significance
|-
| 0x0000
| 0x08
| style="text-align:center;" | LS Byte
|-
| 0x0001
| 0x07
| style="text-align:center;" |
|-
| 0x0002
| 0x06
| style="text-align:center;" |
|-
| 0x0003
| 0x05
| style="text-align:center;" |
|-
| 0x0004
| 0x04
| style="text-align:center;" |
|-
| 0x0005
| 0x03
| style="text-align:center;" |
|-
| 0x0006
| 0x02
| style="text-align:center;" |
|-
| 0x0008
| 0x01
| style="text-align:center;" | MS Byte
|}

==Big-endian Layout==
The [[Big-endian|big-endian]] memory layout, as typical for [[Motorola]] cpus.
For instance the quad word integer 0x0102030405060708
{| class="wikitable"
|-
! Address
! Byte
! Significance
|-
| 0x0000
| 0x01
| style="text-align:center;" | MS Byte
|-
| 0x0001
| 0x02
|
|-
| 0x0002
| 0x03
|
|-
| 0x0003
| 0x04
|
|-
| 0x0004
| 0x05
|
|-
| 0x0005
| 0x06
|
|-
| 0x0006
| 0x07
|
|-
| 0x0007
| 0x08
| style="text-align:center;" | LS Byte
|}

=See also=
* [[Byte]]
* [[Word]]
* [[Double Word]]
* [[Bitboards]]

=External Links=
* [https://en.wikipedia.org/wiki/Word_%28computer_science%29#Dword.2C_Qword.2C_and_Oword Dword, Qword, and Oword from Wikipedia]
* [https://en.wikipedia.org/wiki/Byte Byte from Wikipedia]
* [https://en.wikipedia.org/wiki/Endianness Endianness from Wikipedia]
* [http://betterexplained.com/articles/understanding-big-and-little-endian-byte-order/ Understanding Big and Little Endian Byte Order]
* [http://www.ietf.org/rfc/ien/ien137.txt IEN 137 - DAV's Endian FAQ - On Holy Wars and a Plea for Peace] by [http://www.myri.com/staff/cohen/ Danny Cohen], [http://ai.isi.edu/ U S C/I S I], April 1, 1980

'''[[Data|Up one Level]]'''

Navigation menu