py: Tidy up BINARY_OPs; negation done by special NOT bytecode.
IS_NOT and NOT_IN are now compiled to IS + NOT and IN + NOT, with a new
special NOT bytecode.
diff --git a/py/objstr.c b/py/objstr.c
index fa658ac..3f6aa48 100644
--- a/py/objstr.c
+++ b/py/objstr.c
@@ -168,12 +168,11 @@
}
break;
- case RT_COMPARE_OP_IN:
- case RT_COMPARE_OP_NOT_IN:
+ case RT_BINARY_OP_IN:
/* NOTE `a in b` is `b.__contains__(a)` */
if (MP_OBJ_IS_STR(rhs_in)) {
GET_STR_DATA_LEN(rhs_in, rhs_data, rhs_len);
- return MP_BOOL((op == RT_COMPARE_OP_IN) ^ (find_subbytes(lhs_data, lhs_len, rhs_data, rhs_len) == NULL));
+ return MP_BOOL(find_subbytes(lhs_data, lhs_len, rhs_data, rhs_len) != NULL);
}
break;