Mercurial > cpython-lru_cache-weakref
diff Doc/lib/libstruct.tex @ 18084:bbcdbd8f4469 legacy-trunk
Added q/Q standard (x-platform 8-byte ints) mode in struct module.
This completes the q/Q project.
longobject.c _PyLong_AsByteArray: The original code had a gross bug:
the most-significant Python digit doesn't necessarily have SHIFT
significant bits, and you really need to count how many copies of the sign
bit it has else spurious overflow errors result.
test_struct.py: This now does exhaustive std q/Q testing at, and on both
sides of, all relevant power-of-2 boundaries, both positive and negative.
NEWS: Added brief dict news while I was at it.
| author | Tim Peters <tim.peters@gmail.com> |
|---|---|
| date | Tue, 12 Jun 2001 01:22:22 +0000 |
| parents | 8e187740aa96 |
| children | 27dd9ec3162c |
line wrap: on
line diff
--- a/Doc/lib/libstruct.tex Tue Jun 12 00:30:33 2001 +0000 +++ b/Doc/lib/libstruct.tex Tue Jun 12 01:22:22 2001 +0000 @@ -72,7 +72,8 @@ \item[(1)] The \character{q} and \character{Q} conversion codes are available in native mode only if the platform C compiler supports C \ctype{long long}, - or, on Windows, \ctype{__int64}. + or, on Windows, \ctype{__int64}. They're always available in standard + modes. \end{description} @@ -100,8 +101,8 @@ is truncated. If the string is too short, padding is used to ensure that exactly enough bytes are used to satisfy the count. -For the \character{I} and \character{L} format characters, the return -value is a Python long integer. +For the \character{I}, \character{L}, \character{q} and \character{Q} +format characters, the return value is a Python long integer. For the \character{P} format character, the return value is a Python integer or long integer, depending on the size needed to hold a @@ -139,10 +140,12 @@ order. Standard size and alignment are as follows: no alignment is required -for any type (so you have to use pad bytes); \ctype{short} is 2 bytes; -\ctype{int} and \ctype{long} are 4 bytes. \ctype{float} and -\ctype{double} are 32-bit and 64-bit IEEE floating point numbers, -respectively. +for any type (so you have to use pad bytes); +\ctype{short} is 2 bytes; +\ctype{int} and \ctype{long} are 4 bytes; +\ctype{long long} (\ctype{__int64} on Windows) is 8 bytes; +\ctype{float} and \ctype{double} are 32-bit and 64-bit +IEEE floating point numbers, respectively. Note the difference between \character{@} and \character{=}: both use native byte order, but the size and alignment of the latter is
