$bits{$_}{6} = 'OPpREFCOUNTED' for qw(leave leaveeval leavesub leavesublv leavewrite);
$bits{$_}{6} = 'OPpRUNTIME' for qw(match pushre qr subst substcont);
$bits{$_}{2} = 'OPpSLICEWARNING' for qw(aslice hslice padav padhv rv2av rv2hv);
-$bits{$_}{4} = 'OPpTARGET_MY' for qw(abs add atan2 chdir chmod chomp chown chr chroot complement concat cos crypt divide exec exp flock getpgrp getppid getpriority hex i_add i_divide i_modulo i_multiply i_ncmp i_subtract index int kill left_shift length link log match mkdir modulo multiply oct ord pow push rand rename repeat right_shift rindex rmdir schomp scmp setpgrp setpriority sin sleep split sqrt srand stringify subst subtract symlink system time trans transr unlink unshift utime vec wait waitpid);
+$bits{$_}{4} = 'OPpTARGET_MY' for qw(abs add atan2 chdir chmod chomp chown chr chroot complement concat cos crypt divide exec exp flock getpgrp getppid getpriority hex i_add i_divide i_modulo i_multiply i_ncmp i_subtract index int kill left_shift length link log match mkdir modulo multiply nbit_and nbit_or nbit_xor ncomplement oct ord pow push rand rename repeat right_shift rindex rmdir schomp scmp scomplement setpgrp setpriority sin sleep split sqrt srand stringify subst subtract symlink system time trans transr unlink unshift utime vec wait waitpid);
$bits{$_}{5} = 'OPpTRANS_COMPLEMENT' for qw(trans transr);
$bits{$_}{7} = 'OPpTRANS_DELETE' for qw(trans transr);
$bits{$_}{0} = 'OPpTRANS_FROM_UTF' for qw(trans transr);
@{$bits{msgsnd}}{3,2,1,0} = ($bf[3], $bf[3], $bf[3], $bf[3]);
@{$bits{multideref}}{5,4,0} = ('OPpMULTIDEREF_DELETE', 'OPpMULTIDEREF_EXISTS', $bf[0]);
@{$bits{multiply}}{1,0} = ($bf[1], $bf[1]);
+@{$bits{nbit_and}}{1,0} = ($bf[1], $bf[1]);
+@{$bits{nbit_or}}{1,0} = ($bf[1], $bf[1]);
+@{$bits{nbit_xor}}{1,0} = ($bf[1], $bf[1]);
@{$bits{ncmp}}{1,0} = ($bf[1], $bf[1]);
+$bits{ncomplement}{0} = $bf[0];
@{$bits{ne}}{1,0} = ($bf[1], $bf[1]);
$bits{negate}{0} = $bf[0];
$bits{next}{0} = $bf[0];
@{$bits{rv2sv}}{5,4,0} = ($bf[6], $bf[6], $bf[0]);
$bits{rvalues}{0} = $bf[0];
@{$bits{sassign}}{7,6,1,0} = ('OPpASSIGN_CV_TO_GV', 'OPpASSIGN_BACKWARDS', $bf[1], $bf[1]);
+@{$bits{sbit_and}}{1,0} = ($bf[1], $bf[1]);
+@{$bits{sbit_or}}{1,0} = ($bf[1], $bf[1]);
+@{$bits{sbit_xor}}{1,0} = ($bf[1], $bf[1]);
$bits{scalar}{0} = $bf[0];
$bits{schomp}{0} = $bf[0];
$bits{schop}{0} = $bf[0];
@{$bits{scmp}}{1,0} = ($bf[1], $bf[1]);
+$bits{scomplement}{0} = $bf[0];
@{$bits{seek}}{3,2,1,0} = ($bf[3], $bf[3], $bf[3], $bf[3]);
@{$bits{seekdir}}{3,2,1,0} = ($bf[3], $bf[3], $bf[3], $bf[3]);
@{$bits{select}}{3,2,1,0} = ($bf[3], $bf[3], $bf[3], $bf[3]);
OPpSORT_DESCEND => [qw(sort)],
OPpSPLIT_IMPLIM => [qw(split)],
OPpSUBSTR_REPL_FIRST => [qw(substr)],
- OPpTARGET_MY => [qw(abs add atan2 chdir chmod chomp chown chr chroot complement concat cos crypt divide exec exp flock getpgrp getppid getpriority hex i_add i_divide i_modulo i_multiply i_ncmp i_subtract index int kill left_shift length link log match mkdir modulo multiply oct ord pow push rand rename repeat right_shift rindex rmdir schomp scmp setpgrp setpriority sin sleep split sqrt srand stringify subst subtract symlink system time trans transr unlink unshift utime vec wait waitpid)],
+ OPpTARGET_MY => [qw(abs add atan2 chdir chmod chomp chown chr chroot complement concat cos crypt divide exec exp flock getpgrp getppid getpriority hex i_add i_divide i_modulo i_multiply i_ncmp i_subtract index int kill left_shift length link log match mkdir modulo multiply nbit_and nbit_or nbit_xor ncomplement oct ord pow push rand rename repeat right_shift rindex rmdir schomp scmp scomplement setpgrp setpriority sin sleep split sqrt srand stringify subst subtract symlink system time trans transr unlink unshift utime vec wait waitpid)],
OPpTRANS_COMPLEMENT => [qw(trans transr)],
);
#define Perl_pp_sgt Perl_pp_sle
#define Perl_pp_sge Perl_pp_sle
#define Perl_pp_bit_xor Perl_pp_bit_or
+#define Perl_pp_nbit_xor Perl_pp_nbit_or
+#define Perl_pp_sbit_xor Perl_pp_sbit_or
#define Perl_pp_cos Perl_pp_sin
#define Perl_pp_exp Perl_pp_sin
#define Perl_pp_log Perl_pp_sin
"bit_and",
"bit_xor",
"bit_or",
+ "nbit_and",
+ "nbit_xor",
+ "nbit_or",
+ "sbit_and",
+ "sbit_xor",
+ "sbit_or",
"negate",
"i_negate",
"not",
"complement",
+ "ncomplement",
+ "scomplement",
"smartmatch",
"atan2",
"sin",
"bitwise and (&)",
"bitwise xor (^)",
"bitwise or (|)",
+ "numeric bitiwse and (&)",
+ "numeric bitwise xor (^)",
+ "numeric bitwise or (|)",
+ "string bitiwse and (&)",
+ "string bitwise xor (^)",
+ "string bitwise or (|)",
"negation (-)",
"integer negation (-)",
"not",
"1's complement (~)",
+ "numeric 1's complement (~)",
+ "string 1's complement (~)",
"smart match",
"atan2",
"sin",
Perl_pp_bit_and,
Perl_pp_bit_xor, /* implemented by Perl_pp_bit_or */
Perl_pp_bit_or,
+ Perl_pp_nbit_and,
+ Perl_pp_nbit_xor, /* implemented by Perl_pp_nbit_or */
+ Perl_pp_nbit_or,
+ Perl_pp_sbit_and,
+ Perl_pp_sbit_xor, /* implemented by Perl_pp_sbit_or */
+ Perl_pp_sbit_or,
Perl_pp_negate,
Perl_pp_i_negate,
Perl_pp_not,
Perl_pp_complement,
+ Perl_pp_ncomplement,
+ Perl_pp_scomplement,
Perl_pp_smartmatch,
Perl_pp_atan2,
Perl_pp_sin,
Perl_ck_bitop, /* bit_and */
Perl_ck_bitop, /* bit_xor */
Perl_ck_bitop, /* bit_or */
+ Perl_ck_bitop, /* nbit_and */
+ Perl_ck_bitop, /* nbit_xor */
+ Perl_ck_bitop, /* nbit_or */
+ Perl_ck_bitop, /* sbit_and */
+ Perl_ck_bitop, /* sbit_xor */
+ Perl_ck_bitop, /* sbit_or */
Perl_ck_null, /* negate */
Perl_ck_null, /* i_negate */
Perl_ck_null, /* not */
Perl_ck_bitop, /* complement */
+ Perl_ck_bitop, /* ncomplement */
+ Perl_ck_null, /* scomplement */
Perl_ck_smartmatch, /* smartmatch */
Perl_ck_fun, /* atan2 */
Perl_ck_fun, /* sin */
0x0001120e, /* bit_and */
0x0001120e, /* bit_xor */
0x0001120e, /* bit_or */
+ 0x0001121e, /* nbit_and */
+ 0x0001121e, /* nbit_xor */
+ 0x0001121e, /* nbit_or */
+ 0x0001120e, /* sbit_and */
+ 0x0001120e, /* sbit_xor */
+ 0x0001120e, /* sbit_or */
0x0000112e, /* negate */
0x0000110e, /* i_negate */
0x00001106, /* not */
0x0000111e, /* complement */
+ 0x0000111e, /* ncomplement */
+ 0x0000111e, /* scomplement */
0x00000204, /* smartmatch */
0x0001141e, /* atan2 */
0x00009b9e, /* sin */
12, /* bit_and */
12, /* bit_xor */
12, /* bit_or */
+ 74, /* nbit_and */
+ 74, /* nbit_xor */
+ 74, /* nbit_or */
+ 12, /* sbit_and */
+ 12, /* sbit_xor */
+ 12, /* sbit_or */
0, /* negate */
0, /* i_negate */
0, /* not */
72, /* complement */
+ 72, /* ncomplement */
+ 72, /* scomplement */
12, /* smartmatch */
79, /* atan2 */
72, /* sin */
0x03b8, 0x1570, 0x3c8c, 0x3748, 0x2da5, /* const */
0x29dc, 0x2ef9, /* gvsv */
0x13d5, /* gv */
- 0x0067, /* gelem, lt, i_lt, gt, i_gt, le, i_le, ge, i_ge, eq, i_eq, ne, i_ne, ncmp, slt, sgt, sle, sge, seq, sne, bit_and, bit_xor, bit_or, smartmatch, lslice, xor */
+ 0x0067, /* gelem, lt, i_lt, gt, i_gt, le, i_le, ge, i_ge, eq, i_eq, ne, i_ne, ncmp, slt, sgt, sle, sge, seq, sne, bit_and, bit_xor, bit_or, sbit_and, sbit_xor, sbit_or, smartmatch, lslice, xor */
0x29dc, 0x3bd8, 0x0257, /* padsv */
0x29dc, 0x3bd8, 0x2acc, 0x38c9, /* padav */
0x29dc, 0x3bd8, 0x0534, 0x05d0, 0x2acc, 0x38c9, /* padhv */
0x0c9c, 0x1dd8, 0x0834, 0x3ef0, 0x3a0c, 0x2168, 0x01e4, 0x0141, /* trans, transr */
0x0adc, 0x0458, 0x0067, /* sassign */
0x0758, 0x2acc, 0x0067, /* aassign */
- 0x3ef0, 0x0003, /* chomp, schomp, complement, sin, cos, exp, log, sqrt, int, hex, oct, abs, length, ord, chr, chroot, rmdir */
- 0x3ef0, 0x0067, /* pow, multiply, i_multiply, divide, i_divide, modulo, i_modulo, add, i_add, subtract, i_subtract, concat, left_shift, right_shift, i_ncmp, scmp */
+ 0x3ef0, 0x0003, /* chomp, schomp, complement, ncomplement, scomplement, sin, cos, exp, log, sqrt, int, hex, oct, abs, length, ord, chr, chroot, rmdir */
+ 0x3ef0, 0x0067, /* pow, multiply, i_multiply, divide, i_divide, modulo, i_modulo, add, i_add, subtract, i_subtract, concat, left_shift, right_shift, i_ncmp, scmp, nbit_and, nbit_xor, nbit_or */
0x1058, 0x3ef0, 0x0067, /* repeat */
0x3ef0, 0x012f, /* stringify, atan2, rand, srand, index, rindex, crypt, push, unshift, flock, chdir, chown, unlink, chmod, utime, rename, link, symlink, mkdir, waitpid, system, exec, kill, getpgrp, setpgrp, getpriority, setpriority, sleep */
0x33f0, 0x2acc, 0x00cb, /* substr */
/* BIT_AND */ (OPpARG2_MASK),
/* BIT_XOR */ (OPpARG2_MASK),
/* BIT_OR */ (OPpARG2_MASK),
+ /* NBIT_AND */ (OPpARG2_MASK|OPpTARGET_MY),
+ /* NBIT_XOR */ (OPpARG2_MASK|OPpTARGET_MY),
+ /* NBIT_OR */ (OPpARG2_MASK|OPpTARGET_MY),
+ /* SBIT_AND */ (OPpARG2_MASK),
+ /* SBIT_XOR */ (OPpARG2_MASK),
+ /* SBIT_OR */ (OPpARG2_MASK),
/* NEGATE */ (OPpARG1_MASK),
/* I_NEGATE */ (OPpARG1_MASK),
/* NOT */ (OPpARG1_MASK),
/* COMPLEMENT */ (OPpARG1_MASK|OPpTARGET_MY),
+ /* NCOMPLEMENT */ (OPpARG1_MASK|OPpTARGET_MY),
+ /* SCOMPLEMENT */ (OPpARG1_MASK|OPpTARGET_MY),
/* SMARTMATCH */ (OPpARG2_MASK),
/* ATAN2 */ (OPpARG4_MASK|OPpTARGET_MY),
/* SIN */ (OPpARG1_MASK|OPpTARGET_MY),
}
}
+PP(pp_nbit_and)
+{
+ dSP;
+ tryAMAGICbin_MG(band_amg, AMGf_assign);
+ {
+ dATARGET; dPOPTOPssrl;
+ if (PL_op->op_private & HINT_INTEGER) {
+ const IV i = SvIV_nomg(left) & SvIV_nomg(right);
+ SETi(i);
+ }
+ else {
+ const UV u = SvUV_nomg(left) & SvUV_nomg(right);
+ SETu(u);
+ }
+ }
+ RETURN;
+}
+
+PP(pp_sbit_and)
+{
+ dSP;
+ tryAMAGICbin_MG(sband_amg, AMGf_assign);
+ {
+ dATARGET; dPOPTOPssrl;
+ do_vop(OP_BIT_AND, TARG, left, right);
+ RETSETTARG;
+ }
+}
/* also used for: pp_bit_xor() */
}
}
+/* also used for: pp_nbit_xor() */
+
+PP(pp_nbit_or)
+{
+ dSP;
+ const int op_type = PL_op->op_type;
+
+ tryAMAGICbin_MG((op_type == OP_NBIT_OR ? bor_amg : bxor_amg),
+ AMGf_assign);
+ {
+ dATARGET; dPOPTOPssrl;
+ if (PL_op->op_private & HINT_INTEGER) {
+ const IV l = (USE_LEFT(left) ? SvIV_nomg(left) : 0);
+ const IV r = SvIV_nomg(right);
+ const IV result = op_type == OP_NBIT_OR ? (l | r) : (l ^ r);
+ SETi(result);
+ }
+ else {
+ const UV l = (USE_LEFT(left) ? SvUV_nomg(left) : 0);
+ const UV r = SvUV_nomg(right);
+ const UV result = op_type == OP_NBIT_OR ? (l | r) : (l ^ r);
+ SETu(result);
+ }
+ }
+ RETURN;
+}
+
+/* also used for: pp_sbit_xor() */
+
+PP(pp_sbit_or)
+{
+ dSP;
+ const int op_type = PL_op->op_type;
+
+ tryAMAGICbin_MG((op_type == OP_SBIT_OR ? sbor_amg : sbxor_amg),
+ AMGf_assign);
+ {
+ dATARGET; dPOPTOPssrl;
+ do_vop(op_type == OP_SBIT_OR ? OP_BIT_OR : OP_BIT_XOR, TARG, left,
+ right);
+ RETSETTARG;
+ }
+}
+
PERL_STATIC_INLINE bool
S_negate_string(pTHX)
{
return NORMAL;
}
-PP(pp_complement)
+static void
+S_scomplement(pTHX_ SV *targ, SV *sv)
{
- dSP; dTARGET;
- tryAMAGICun_MG(compl_amg, AMGf_numeric);
- {
- dTOPss;
- if (SvNIOKp(sv)) {
- if (PL_op->op_private & HINT_INTEGER) {
- const IV i = ~SvIV_nomg(sv);
- SETi(i);
- }
- else {
- const UV u = ~SvUV_nomg(sv);
- SETu(u);
- }
- }
- else {
U8 *tmps;
I32 anum;
STRLEN len;
sv_usepvn_flags(TARG, (char*)result, nchar, SV_HAS_TRAILING_NUL);
SvUTF8_off(TARG);
}
- SETTARG;
- return NORMAL;
+ return;
}
#ifdef LIBERAL
{
#endif
for ( ; anum > 0; anum--, tmps++)
*tmps = ~*tmps;
+}
+
+PP(pp_complement)
+{
+ dSP; dTARGET;
+ tryAMAGICun_MG(compl_amg, AMGf_numeric);
+ {
+ dTOPss;
+ if (SvNIOKp(sv)) {
+ if (PL_op->op_private & HINT_INTEGER) {
+ const IV i = ~SvIV_nomg(sv);
+ SETi(i);
+ }
+ else {
+ const UV u = ~SvUV_nomg(sv);
+ SETu(u);
+ }
+ }
+ else {
+ S_scomplement(aTHX_ TARG, sv);
SETTARG;
}
return NORMAL;
}
}
+PP(pp_ncomplement)
+{
+ dSP;
+ tryAMAGICun_MG(compl_amg, AMGf_numeric);
+ {
+ dTARGET; dTOPss;
+ if (PL_op->op_private & HINT_INTEGER) {
+ const IV i = ~SvIV_nomg(sv);
+ SETi(i);
+ }
+ else {
+ const UV u = ~SvUV_nomg(sv);
+ SETu(u);
+ }
+ }
+ return NORMAL;
+}
+
+PP(pp_scomplement)
+{
+ dSP;
+ tryAMAGICun_MG(scompl_amg, AMGf_numeric);
+ {
+ dTARGET; dTOPss;
+ S_scomplement(aTHX_ TARG, sv);
+ SETTARG;
+ return NORMAL;
+ }
+}
+
/* integer versions of some of the above */
PP(pp_i_multiply)