bytes: Implement comparison and other binary operations.
Should support everything supported by strings.
diff --git a/py/sequence.c b/py/sequence.c
index 63f6bd6..3d2bbba 100644
--- a/py/sequence.c
+++ b/py/sequence.c
@@ -83,6 +83,10 @@
// Special-case comparison function for sequences of bytes
// Don't pass MP_BINARY_OP_NOT_EQUAL here
bool mp_seq_cmp_bytes(int op, const byte *data1, uint len1, const byte *data2, uint len2) {
+ if (op == MP_BINARY_OP_EQUAL && len1 != len2) {
+ return false;
+ }
+
// Let's deal only with > & >=
if (op == MP_BINARY_OP_LESS || op == MP_BINARY_OP_LESS_EQUAL) {
SWAP(const byte*, data1, data2);