From ee4959ee8cf865024a07b7260c26ca8b47a49dbb Mon Sep 17 00:00:00 2001 From: Guillaume Horel Date: Wed, 1 Feb 2023 12:53:55 -0500 Subject: dead code --- pyisda/curve.pxd | 62 -------------------------------------------------------- 1 file changed, 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(cursor) - cursor += sizeof(int) + sizeof(TRatePt) * n - base_date = deref(cursor) - cursor += sizeof(TDate) - basis = deref(cursor) - cursor += sizeof(double) - dcc = deref(cursor) - memmove(buf + sizeof(TCurve), buf + sizeof(TRatePt*) + sizeof(int), sizeof(TRatePt) * n) - curve = buf - curve.fArray = (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 = 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 -- cgit v1.2.3-70-g09d2