diff options
| author | Guillaume Horel <guillaume.horel@gmail.com> | 2023-02-01 12:53:55 -0500 |
|---|---|---|
| committer | Guillaume Horel <guillaume.horel@gmail.com> | 2023-02-01 12:53:55 -0500 |
| commit | ee4959ee8cf865024a07b7260c26ca8b47a49dbb (patch) | |
| tree | 56af68312389f6e4190ff5d1dd37f98e81b07b84 | |
| parent | 4334cf909f16376dd4d58bdd5f227aad43028ef3 (diff) | |
| download | pyisda-ee4959ee8cf865024a07b7260c26ca8b47a49dbb.tar.gz | |
dead code
| -rw-r--r-- | pyisda/curve.pxd | 62 |
1 files changed, 0 insertions, 62 deletions
diff --git a/pyisda/curve.pxd b/pyisda/curve.pxd index 696a05d..8226fe9 100644 --- a/pyisda/curve.pxd +++ b/pyisda/curve.pxd @@ -44,68 +44,6 @@ cdef extern from "farmhash.h" namespace 'util' nogil: uint64_t Hash64(const char *buff, size_t len) uint64_t Hash64WithSeed(const char *buff, size_t len, uint64_t len) -cdef inline size_t TCurve_size(const TCurve* curve) nogil: - # this relies on TCurve having no padding - return sizeof(TCurve) - sizeof(TRatePt*) + sizeof(TRatePt) * curve.fNumItems - -cdef inline unsigned char* serialize(const TCurve* curve, unsigned char* buf) nogil: - memcpy(buf, &(curve.fNumItems), sizeof(curve.fNumItems)) - buf += sizeof(curve.fNumItems) - memcpy(buf, curve.fArray, sizeof(TRatePt) * curve.fNumItems) - buf += sizeof(TRatePt) * curve.fNumItems - memcpy(buf, &(curve.fBaseDate), sizeof(TDate)) - buf += sizeof(TDate) - memcpy(buf, &(curve.fBasis), sizeof(curve.fBasis)) - buf += sizeof(curve.fBasis) - memcpy(buf, &(curve.fDayCountConv), sizeof(curve.fDayCountConv)) - return buf + sizeof(curve.fDayCountConv) - -cdef inline void serialize_vector(const vector[TDate]& v, unsigned char* cursor) nogil: - cdef size_t size = v.size() - memcpy(cursor, &size, sizeof(size_t)) - cursor += sizeof(size_t) - memcpy(cursor, v.data(), sizeof(TDate) * v.size()) - -cdef inline int fixup(char* buf) nogil: - cdef: - TDate base_date - double basis - int dcc - int n - char* cursor - TCurve* curve - cursor = buf + sizeof(TRatePt*) - n = deref(<int*>cursor) - cursor += sizeof(int) + sizeof(TRatePt) * n - base_date = deref(<TDate*>cursor) - cursor += sizeof(TDate) - basis = deref(<double*>cursor) - cursor += sizeof(double) - dcc = <int>deref(<long*>cursor) - memmove(buf + sizeof(TCurve), buf + sizeof(TRatePt*) + sizeof(int), sizeof(TRatePt) * n) - curve = <TCurve*>buf - curve.fArray = <TRatePt*>(buf + sizeof(TCurve)) - curve.fDayCountConv = dcc - curve.fBaseDate = base_date - curve.fBasis = basis - return sizeof(TCurve) + n * sizeof(TRatePt) - - -cdef inline const unsigned char* deserialize(const unsigned char* buf, TCurve* curve) nogil: - memcpy(&curve.fNumItems, buf, sizeof(curve.fNumItems)) - buf += sizeof(curve.fNumItems) - cdef size_t array_size = sizeof(TRatePt) * curve.fNumItems - curve.fArray = <TRatePt*>malloc(array_size) - memcpy(curve.fArray, buf, array_size) - buf += array_size - memcpy(&curve.fBaseDate, buf, sizeof(TDate)) - buf += sizeof(TDate) - memcpy(&curve.fBasis, buf, sizeof(curve.fBasis)) - buf += sizeof(curve.fBasis) - memcpy(&curve.fDayCountConv, buf, sizeof(curve.fDayCountConv)) - buf += sizeof(curve.fDayCountConv) - return buf - cdef extern from "isda/cds.h" nogil: TCurve* JpmcdsCleanSpreadCurve( # Risk starts at the end of today |
