summaryrefslogtreecommitdiff
path: root/doop.c
diff options
context:
space:
mode:
authorKarl Williamson <khw@cpan.org>2020-05-29 14:25:19 -0600
committerKarl Williamson <khw@cpan.org>2020-07-17 22:04:08 -0600
commitd223e1ea9ae864c0e563187f1e76240ef1acad87 (patch)
treef670961d58ff3c055cff40637ca9daacaf1b462e /doop.c
parent0654f0ab17405d0d55f0006348b4ed0084aa1fc8 (diff)
downloadperl-d223e1ea9ae864c0e563187f1e76240ef1acad87.tar.gz
handy.h: Create nBIT_MASK(n) macro
This encapsulates a common paradigm, making sure that it is done correctly for the platform's size.
Diffstat (limited to 'doop.c')
-rw-r--r--doop.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/doop.c b/doop.c
index 267b640f4d..a06992f906 100644
--- a/doop.c
+++ b/doop.c
@@ -857,7 +857,7 @@ Perl_do_vecget(pTHX_ SV *sv, STRLEN offset, int size)
}
}
else if (size < 8)
- retnum = (s[uoffset] >> bitoffs) & ((1 << size) - 1);
+ retnum = (s[uoffset] >> bitoffs) & nBIT_MASK(size);
else {
if (size == 8)
retnum = s[uoffset];
@@ -960,7 +960,7 @@ Perl_do_vecset(pTHX_ SV *sv)
}
if (size < 8) {
- mask = (1 << size) - 1;
+ mask = nBIT_MASK(size);
lval &= mask;
s[offset] &= ~(mask << bitoffs);
s[offset] |= lval << bitoffs;