diff options
author | Jarkko Hietaniemi <jhi@iki.fi> | 2015-07-17 11:12:42 +0300 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2015-07-17 11:12:42 +0300 |
commit | fb7e9cdd4113e4cf1a43224b3f50ca540d8fc1b4 (patch) | |
tree | 0dbff586292bff55d7b8af63acbbb7be7b82b9f6 | |
parent | 9b1753cf7072d34b7e4bd1ea60369cbaf80e6152 (diff) | |
download | perl-fb7e9cdd4113e4cf1a43224b3f50ca540d8fc1b4.tar.gz |
perldelta tweaks on the shift.
-rw-r--r-- | pod/perldelta.pod | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/pod/perldelta.pod b/pod/perldelta.pod index 06e638f35c..6be1dccfe3 100644 --- a/pod/perldelta.pod +++ b/pod/perldelta.pod @@ -27,7 +27,7 @@ here, but most should go in the L</Performance Enhancements> section. [ List each enhancement as a =head2 entry ] -=head2 Integer shift (C<< << >> and C<< >> >>) now explicitly defined +=head2 Integer shift (C<< << >> and C<< >> >>) now more explicitly defined Negative shifts are reverse shifts: left shift becomes right shift, and right shift becomes left shift. @@ -38,7 +38,7 @@ C<use integer>, in which case the result is -1 (arithmetic shift). Until now negative shifting and overshifting have been undefined because they have relied on whatever the C implementation happens -to do. For example, for the "overshift" a common behavior C is +to do. For example, for the overshift a common C behavior is "modulo shift": 1 >> 64 == 1 >> (64 % 64) == 1 >> 0 == 1 # Common C behavior. @@ -47,8 +47,14 @@ to do. For example, for the "overshift" a common behavior C is Now these behaviors are well-defined under Perl, regardless of what the underlying C implementation does. Note, however, that you cannot -escape the native integer width. If you need more bits on the left shift, -you could use the C<bigint> pragma. +escape the native integer width, you need to know how far left you +can go. You can use for example: + + use Config; + my $wordbits = $Config{uvsize} * 8; # Or $Config{uvsize} << 3. + +If you need a more bits on the left shift, you can use for example +the C<bigint> pragma, or the C<Bit::Vector> module from CPAN. =head2 Postfix dereferencing is no longer experimental |