Merge pull request #40 from Decompollaborate/develop

1.7.7
This commit is contained in:
Anghelo Carvajal 2023-08-27 13:02:47 -04:00 committed by GitHub
commit 8e5643b04d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 17 additions and 9 deletions

View File

@ -4,7 +4,7 @@
[package]
name = "rabbitizer"
# Version should be synced with include/common/RabbitizerVersion.h
version = "1.7.6"
version = "1.7.7"
edition = "2021"
authors = ["Anghelo Carvajal <angheloalf95@gmail.com>"]
description = "MIPS instruction decoder"

View File

@ -14,7 +14,7 @@ extern "C" {
// Header version
#define RAB_VERSION_MAJOR 1
#define RAB_VERSION_MINOR 7
#define RAB_VERSION_PATCH 6
#define RAB_VERSION_PATCH 7
#define RAB_VERSION_STR RAB_STRINGIFY(RAB_VERSION_MAJOR) "." RAB_STRINGIFY(RAB_VERSION_MINOR) "." RAB_STRINGIFY(RAB_VERSION_PATCH)

View File

@ -4,7 +4,7 @@
[project]
name = "rabbitizer"
# Version should be synced with include/common/RabbitizerVersion.h
version = "1.7.6"
version = "1.7.7"
description = "MIPS instruction decoder"
# license = "MIT"
readme = "README.md"

View File

@ -20,5 +20,7 @@ class Enum:
def __gt__(self, __o: object) -> bool: ...
def __ge__(self, __o: object) -> bool: ...
def __hash__(self) -> int: ...
def __repr__(self) -> str: ...
def __str__(self) -> str: ...

View File

@ -91,15 +91,21 @@ static PyGetSetDef rabbitizer_type_Enum_getsetters[] = {
};
// Crappy hash
Py_hash_t rabbitizer_type_Enum_hash(PyRabbitizerEnum *self) {
Py_hash_t hash = PyObject_Hash(self->enumType);
PyObject *tuple = PyTuple_Pack(2, self->enumType, PyLong_FromLong(self->value));
Py_hash_t hash;
if (tuple == NULL) {
return -1;
}
hash = PyObject_Hash(tuple);
if (hash == -1) {
return -1;
}
return hash + self->value;
return hash;
}
// Checks for the 6 basic comparisons (==, !=, <, <=, >, >=)
@ -140,8 +146,8 @@ PyObject *rabbitizer_type_Enum_richcompare(PyRabbitizerEnum *self, PyObject *oth
switch (op) {
case Py_EQ: if ((self->value) == (otherValue)) Py_RETURN_TRUE; Py_RETURN_FALSE;
case Py_NE: if ((self->value) != (otherValue)) Py_RETURN_TRUE; Py_RETURN_FALSE;
case Py_LT: if ((self->value) < (otherValue)) Py_RETURN_TRUE; Py_RETURN_FALSE;
case Py_GT: if ((self->value) > (otherValue)) Py_RETURN_TRUE; Py_RETURN_FALSE;
case Py_LT: if ((self->value) < (otherValue)) Py_RETURN_TRUE; Py_RETURN_FALSE;
case Py_GT: if ((self->value) > (otherValue)) Py_RETURN_TRUE; Py_RETURN_FALSE;
case Py_LE: if ((self->value) <= (otherValue)) Py_RETURN_TRUE; Py_RETURN_FALSE;
case Py_GE: if ((self->value) >= (otherValue)) Py_RETURN_TRUE; Py_RETURN_FALSE;
default:
@ -158,7 +164,7 @@ static PyObject *rabbitizer_type_Enum___reduce__(PyRabbitizerEnum *self, UNUSED
PyObject *name;
PyObject *value;
enumType = self->enumType;
enumType = self->enumType;
Py_INCREF(enumType);
name = self->name;
Py_INCREF(name);