From 154741798b4931467aefe663c37a8ff876d5ece3 Mon Sep 17 00:00:00 2001 From: "Zooko O'Whielacronx zooko@zooko.com" Date: Sat, 14 Apr 2007 23:21:48 +0530 Subject: [PATCH] pyfec: tighten internal datatype from int to short and undo attempt to make it unsigned (Python doesn't do unsigned short) darcs-hash:07e5b74c6c77e672407f3a302105b5d5a202b219 --- 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 2c7fa1b..a4982b1 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