An unsigned int64 type variable here is an object with two 32-bit properties
.h - highest 32-bits (register AH)
.l - lowest 32-bits (register AL)
All math is for unsigned case only.
Samples:
64-bit values
k=0x000FFFFFFFFFFF00
m=0x0000000FFFFFFFFF
bitwise AND
k & m = 0x0000000FFFFFFF00
bitwise OR
k | m = 0x000FFFFFFFFFFFFF
bitwise XOR
k ^ m = 0x000FFFF0000000FF
bitwise NOT
~k = 0xFFF00000000000FF
LEFT bit-SHIFT
k << 4 = 0x00FFFFFFFFFFF000
RIGHT bit-SHIFT
k >> 4 = 0x0000FFFFFFFFFFF0
math ADD
k + m = 0x0010000FFFFFFEFF
math SUBTRACT
k - m = 0x000FFFEFFFFFFF01
math simple multiplication
by incrementing 2 times = 0x001FFFFFFFFFFE00
by multiplying registers = 0x001FFFFFFFFFFE00
by shifting bits = 0x001FFFFFFFFFFE00
math simple division
by shifting bits k/m = 0x0000000000010000 reminder = 0x000000000000FF00
verify backwards k= 0x000FFFFFFFFFFF00
math simple power (0x2)^63 = 0x8000000000000000
math modulo operation 0x8 % 0x3 = 0x0000000000000002
math primes of 0x60000000 = 2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*3
convert 0xFFFFFFFFFFFFFFFF to decimal string = 18446744073709551615
convert backwards = 0xFFFFFFFFFFFFFFFF
Get, set, clear bit 63 which is 0 right now
after set k= 0x800FFFFFFFFFFF00
after clear k= 0x000FFFFFFFFFFF00
IF logic
k == m ---- false
k > m ---- true
k <= m ---- false
It is not good for operations as mul,div,pow,sqrt,...
Not a case of fast performance.
Anyway, properly working sample at site: jsCuckoo chess.
Source jsCuckoo.js
Scripts for copy-paste or include in other projects int64.js
Other oldie:
For serious BigNumber math try this site: http://jsfromhell.com/classes/bignumber