magit/magit — pull request #425 by YorkZ (2012-06-11 00:35:39+00:00)
Title: magit-blame: Fix "Wrong type argument" and "Arithmetic range error" erro...

...r

The UNIX TIME is a 32 bit integer, however, since integer number in Emacs is
only 30 bits, the UNIX TIME has to be represented by a floating point number.
The algorithm is to first divide the time (floating point number) by 4, which is
equivalent to right shifting 2 bits to make a 30 bits integer number (discarding
the lowest 2 bits). Since this number is the higher 30 bits of the time, by
right shifting 14 bits we get the HIGH (16 bits) part. The original floating
point time mod 4 we get the lowest 2 bits of the time. Take the 30 bits number
calculated in the earlier steps, wipe out the higher 16 bits and we get the
higher 14 bits of the LOW part, left shifting 2 bits and "inclusive or" the
lowest 2 bits we get the final LOW part, therefor, converted the floating point
UNIX TIME to the (HIGH LOW) format representation.