PERL_ARGS_ASSERT_CK_BITOP;
-#define OP_IS_NUMCOMPARE(op) \
- ((op) == OP_LT || (op) == OP_I_LT || \
- (op) == OP_GT || (op) == OP_I_GT || \
- (op) == OP_LE || (op) == OP_I_LE || \
- (op) == OP_GE || (op) == OP_I_GE || \
- (op) == OP_EQ || (op) == OP_I_EQ || \
- (op) == OP_NE || (op) == OP_I_NE || \
- (op) == OP_NCMP || (op) == OP_I_NCMP)
o->op_private = (U8)(PL_hints & HINT_INTEGER);
if (!(o->op_flags & OPf_STACKED) /* Not an assignment */
&& (o->op_type == OP_BIT_OR
#define OP_IS_FILETEST_ACCESS(op) \
((op) >= OP_FTRREAD && (op) <= OP_FTEEXEC)
+#define OP_IS_NUMCOMPARE(op) \
+ ((op) >= OP_LT && (op) <= OP_I_NCMP)
+
/* ex: set ro: */
'u' => 128, # defaults to $_
);
-my %OP_IS_SOCKET;
-my %OP_IS_FILETEST;
-my %OP_IS_FT_ACCESS;
+my %OP_IS_SOCKET; # /Fs/
+my %OP_IS_FILETEST; # /F-/
+my %OP_IS_FT_ACCESS; # /F-+/
+my %OP_IS_NUMCOMPARE; # /S</
my $OCSHIFT = 8;
my $OASHIFT = 12;
$OP_IS_FILETEST{$op} = $opnum{$op} if $arg =~ s/-//;
$OP_IS_FT_ACCESS{$op} = $opnum{$op} if $arg =~ s/\+//;
}
+ elsif ($arg =~ /^S</) {
+ $OP_IS_NUMCOMPARE{$op} = $opnum{$op} if $arg =~ s/<//;
+ }
my $argnum = ($arg =~ s/\?//) ? 8 : 0;
die "op = $op, arg = $arg\n"
unless exists $argnum{$arg};
gen_op_is_macro( \%OP_IS_SOCKET, 'OP_IS_SOCKET');
gen_op_is_macro( \%OP_IS_FILETEST, 'OP_IS_FILETEST');
gen_op_is_macro( \%OP_IS_FT_ACCESS, 'OP_IS_FILETEST_ACCESS');
+gen_op_is_macro( \%OP_IS_NUMCOMPARE, 'OP_IS_NUMCOMPARE');
sub gen_op_is_macro {
my ($op_is, $macname) = @_;
if ( $op_is->{$last} - $op_is->{$first} == scalar @rest + 1) {
# contiguous ops -> optimized version
- print $on "(op) >= OP_" . uc($first) . " && (op) <= OP_" . uc($last);
- print $on ")\n";
+ print $on "(op) >= OP_" . uc($first)
+ . " && (op) <= OP_" . uc($last);
}
else {
print $on join(" || \\\n\t ",
- map { "(op) == OP_" . uc() } sort keys %$op_is);
- print $on ")\n";
+ map { "(op) == OP_" . uc() } sort keys %$op_is);
}
+ print $on ")\n";
}
}
# scalar - S list - L array - A
# hash - H sub (CV) - C file - F
# socket - Fs filetest - F- filetest_access - F-+
+# num-compare - S<
# reference - R
# "?" denotes an optional operand.
left_shift left bitshift (<<) ck_bitop fsT2 S S
right_shift right bitshift (>>) ck_bitop fsT2 S S
-lt numeric lt (<) ck_null Iifs2 S S
-i_lt integer lt (<) ck_null ifs2 S S
-gt numeric gt (>) ck_null Iifs2 S S
-i_gt integer gt (>) ck_null ifs2 S S
-le numeric le (<=) ck_null Iifs2 S S
-i_le integer le (<=) ck_null ifs2 S S
-ge numeric ge (>=) ck_null Iifs2 S S
-i_ge integer ge (>=) ck_null ifs2 S S
-eq numeric eq (==) ck_null Iifs2 S S
-i_eq integer eq (==) ck_null ifs2 S S
-ne numeric ne (!=) ck_null Iifs2 S S
-i_ne integer ne (!=) ck_null ifs2 S S
-ncmp numeric comparison (<=>) ck_null Iifst2 S S
-i_ncmp integer comparison (<=>) ck_null ifst2 S S
+lt numeric lt (<) ck_null Iifs2 S S<
+i_lt integer lt (<) ck_null ifs2 S S<
+gt numeric gt (>) ck_null Iifs2 S S<
+i_gt integer gt (>) ck_null ifs2 S S<
+le numeric le (<=) ck_null Iifs2 S S<
+i_le integer le (<=) ck_null ifs2 S S<
+ge numeric ge (>=) ck_null Iifs2 S S<
+i_ge integer ge (>=) ck_null ifs2 S S<
+eq numeric eq (==) ck_null Iifs2 S S<
+i_eq integer eq (==) ck_null ifs2 S S<
+ne numeric ne (!=) ck_null Iifs2 S S<
+i_ne integer ne (!=) ck_null ifs2 S S<
+ncmp numeric comparison (<=>) ck_null Iifst2 S S<
+i_ncmp integer comparison (<=>) ck_null ifst2 S S<
slt string lt ck_null ifs2 S S
sgt string gt ck_null ifs2 S S