diff options
author | Tim Peters <tim.peters@gmail.com> | 2001-06-12 01:22:22 (GMT) |
---|---|---|
committer | Tim Peters <tim.peters@gmail.com> | 2001-06-12 01:22:22 (GMT) |
commit | 7a3bfc3a472dafc42d20845389eb79db8af0b046 (patch) | |
tree | 5b59ec1db42d4559a21af550c3b068b053ac79d2 /Doc | |
parent | ac4797a12eed2fb5bcc68ae6e768e5ab4ec5b422 (diff) | |
download | cpython-7a3bfc3a472dafc42d20845389eb79db8af0b046.zip cpython-7a3bfc3a472dafc42d20845389eb79db8af0b046.tar.gz cpython-7a3bfc3a472dafc42d20845389eb79db8af0b046.tar.bz2 |
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.
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/lib/libstruct.tex | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/Doc/lib/libstruct.tex b/Doc/lib/libstruct.tex index 9a1942d..f8056a2 100644 --- a/Doc/lib/libstruct.tex +++ b/Doc/lib/libstruct.tex @@ -72,7 +72,8 @@ Notes: \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 @@ passed in to \function{pack()} is too long, the stored representation 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 @@ Native size and alignment are determined using the C compiler's 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 |