From c5a0f51aeadf6b8a7ed259c017c10b71dbc08619 Mon Sep 17 00:00:00 2001 From: Jarkko Hietaniemi Date: Sun, 29 Aug 1999 08:56:15 +0000 Subject: Implement 64-bit vec(). p4raw-id: //depot/cfgperl@4035 --- pod/perldelta.pod | 13 +++++++------ pod/perldiag.pod | 6 +++++- pod/perlfunc.pod | 9 ++++++--- 3 files changed, 18 insertions(+), 10 deletions(-) (limited to 'pod') diff --git a/pod/perldelta.pod b/pod/perldelta.pod index 90f1729020..26a6450c6b 100644 --- a/pod/perldelta.pod +++ b/pod/perldelta.pod @@ -161,19 +161,20 @@ use "quads" (64-integers) as follows: =item in basic arithmetics +=item vec() (but see the below note about bit arithmetics) + =back Note that unless you have the case (a) you will have to configure and compile Perl using the -Duse64bits Configure flag. -Unfortunately, bit operations (&, <<, ...) and vec() do not work, -they are limited to 32 bits. +Unfortunately bit arithmetics (&, |, ^, ~, <<, >>) are not 64-bit clean. Last but not least: note that due to Perl's habit of always using -floating point numbers the quads are still not true integers. When -quads overflow their limits (18446744073709551615 unsigned, --9223372036854775808...9223372036854775807 signed), they are silently -promoted to floating point numbers, after which they will +floating point numbers the quads are still not true integers. +When quads overflow their limits (0...18_446_744_073_709_551_615 unsigned, +-9_223_372_036_854_775_808...9_223_372_036_854_775_807 signed), they +are silently promoted to floating point numbers, after which they will start losing precision (their lower digits). =head2 Large file support diff --git a/pod/perldiag.pod b/pod/perldiag.pod index 49e654afb5..90439402a8 100644 --- a/pod/perldiag.pod +++ b/pod/perldiag.pod @@ -488,6 +488,10 @@ L for more on portability concerns. (W) You tried to do a bind on a closed socket. Did you forget to check the return value of your socket() call? See L. +=item Bit vector size > 32 non-portable + +(W) Using bit vector sizes larger than 32 is non-portable. + =item Bizarre copy of %s in %s (P) Perl detected an attempt to copy an internal value that is not copiable. @@ -1522,7 +1526,7 @@ before the illegal character. =item Illegal number of bits in vec (F) The number of bits in vec() (the third argument) must be a power of -two from 1 to 32. +two from 1 to 32 (or 64, if your platform supports that). =item Illegal switch in PERL5OPT: %s diff --git a/pod/perlfunc.pod b/pod/perlfunc.pod index 0e4b7c7cc3..25c8efe27c 100644 --- a/pod/perlfunc.pod +++ b/pod/perlfunc.pod @@ -4990,15 +4990,18 @@ See also C, C, and C. Treats the string in EXPR as a vector of unsigned integers, and returns the value of the bit field specified by OFFSET. BITS specifies the number of bits that are reserved for each entry in the -bit vector. This must be a power of two from 1 to 32. +bit vector. This must be a power of two from 1 to 32 (or 64, if your +platform supports that). + C may also be assigned to, in which case parentheses are needed to give the expression the correct precedence as in vec($image, $max_x * $x + $y, 8) = 3; Vectors created with C can also be manipulated with the logical -operators C<|>, C<&>, and C<^>, which will assume a bit vector operation is -desired when both operands are strings. See L. +operators C<|>, C<&>, and C<^>, which will assume a bit vector +operation is desired when both operands are strings. +See L. The following code will build up an ASCII string saying C<'PerlPerlPerl'>. The comments show the string after each step. Note that this code works -- cgit v1.2.1