From 50353b982b30f3e9bb897ebacff0a908c6e40302 Mon Sep 17 00:00:00 2001 From: Zooko O'Whielacronx Date: Sat, 14 Apr 2007 10:51:48 -0700 Subject: [PATCH] pyfec: tighten internal datatype from int to short and undo attempt to make it unsigned (Python doesn't do unsigned short) --- pyfec/fec/_fecmodule.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/pyfec/fec/_fecmodule.c b/pyfec/fec/_fecmodule.c index 2c7fa1b2..a4982b1c 100644 --- a/pyfec/fec/_fecmodule.c +++ b/pyfec/fec/_fecmodule.c @@ -71,8 +71,8 @@ typedef struct { PyObject_HEAD /* expose these */ - unsigned short kk; - unsigned short mm; + short kk; + short mm; /* internal */ fec_t* fec_matrix; @@ -119,8 +119,8 @@ Encoder_init(Encoder *self, PyObject *args, PyObject *kwdict) { py_raise_fec_error("Precondition violation: first argument is required to be less than or equal to the second argument, but they were %d and %d respectively", ink, inm); return -1; } - self->kk = (unsigned short)ink; - self->mm = (unsigned short)inm; + self->kk = (short)ink; + self->mm = (short)inm; self->fec_matrix = fec_new(self->kk, self->mm); return 0; @@ -269,8 +269,8 @@ static PyMethodDef Encoder_methods[] = { }; static PyMemberDef Encoder_members[] = { - {"k", T_INT, offsetof(Encoder, kk), READONLY, "k"}, - {"m", T_INT, offsetof(Encoder, mm), READONLY, "m"}, + {"k", T_SHORT, offsetof(Encoder, kk), READONLY, "k"}, + {"m", T_SHORT, offsetof(Encoder, mm), READONLY, "m"}, {NULL} /* Sentinel */ }; @@ -326,8 +326,8 @@ typedef struct { PyObject_HEAD /* expose these */ - unsigned short kk; - unsigned short mm; + short kk; + short mm; /* internal */ fec_t* fec_matrix; @@ -375,8 +375,8 @@ Decoder_init(Encoder *self, PyObject *args, PyObject *kwdict) { py_raise_fec_error("Precondition violation: first argument is required to be less than or equal to the second argument, but they were %d and %d respectively", ink, inm); return -1; } - self->kk = (unsigned short)ink; - self->mm = (unsigned short)inm; + self->kk = (short)ink; + self->mm = (short)inm; self->fec_matrix = fec_new(self->kk, self->mm); return 0; @@ -533,8 +533,8 @@ static PyMethodDef Decoder_methods[] = { }; static PyMemberDef Decoder_members[] = { - {"k", T_INT, offsetof(Encoder, kk), READONLY, "k"}, - {"m", T_INT, offsetof(Encoder, mm), READONLY, "m"}, + {"k", T_SHORT, offsetof(Encoder, kk), READONLY, "k"}, + {"m", T_SHORT, offsetof(Encoder, mm), READONLY, "m"}, {NULL} /* Sentinel */ }; -- 2.45.2