From: Zooko O'Whielacronx Date: Sat, 14 Apr 2007 17:51:48 +0000 (-0700) Subject: pyfec: tighten internal datatype from int to short and undo attempt to make it unsign... X-Git-Url: https://git.rkrishnan.org/cyclelanguage?a=commitdiff_plain;h=50353b982b30f3e9bb897ebacff0a908c6e40302;p=tahoe-lafs%2Ftahoe-lafs.git pyfec: tighten internal datatype from int to short and undo attempt to make it unsigned (Python doesn't do unsigned short) --- 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 */ };