From ca6bc4d9aa7df2c3fd4f102a5a999558b73a938e Mon Sep 17 00:00:00 2001 From: Guillaume Horel Date: Tue, 6 Jun 2017 15:24:26 -0400 Subject: farm is the new city --- pyisda/curve.pxd | 4 ++-- pyisda/curve.pyx | 6 +++--- setup.py | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/pyisda/curve.pxd b/pyisda/curve.pxd index 632d2e1..2419d1d 100644 --- a/pyisda/curve.pxd +++ b/pyisda/curve.pxd @@ -38,8 +38,8 @@ cdef extern from "isda/bastypes.h": TDate fDate double fRate -cdef extern from "city.h" nogil: - uint64_t c_CityHash64 "CityHash64" (char *buff, size_t len) +cdef extern from "farmhash.h" namespace 'util' nogil: + uint64_t Hash64(const char *buff, size_t len) cdef inline size_t TCurve_size(int num_items) nogil: return sizeof(int) + sizeof(TDate) + sizeof(double) + \ diff --git a/pyisda/curve.pyx b/pyisda/curve.pyx index 082d5e0..60858b8 100644 --- a/pyisda/curve.pyx +++ b/pyisda/curve.pyx @@ -63,7 +63,7 @@ cdef class Curve(object): size_t curve_size = TCurve_size(curve.fNumItems) unsigned char* buf = malloc(curve_size * sizeof(unsigned char)) serialize(curve, buf) - cdef uint64_t r = c_CityHash64(buf, curve_size) + cdef uint64_t r = Hash64(buf, curve_size) free(buf) return r @@ -328,7 +328,7 @@ cdef class YieldCurve(Curve): memcpy(cursor, &size, sizeof(size_t)) cursor += sizeof(size_t) memcpy(cursor, self.dates.data(), sizeof(TDate) * size) - cdef uint64_t r = c_CityHash64(buf, buf_size) + cdef uint64_t r = Hash64(buf, buf_size) free(buf) return r @@ -545,7 +545,7 @@ cdef class SpreadCurve(Curve): memcpy(cursor, &size, sizeof(size_t)) cursor += sizeof(size_t) self.ticker.copy(cursor, size, 0) - cdef uint64_t r = c_CityHash64(buf, buf_size) + cdef uint64_t r = Hash64(buf, buf_size) free(buf) return r diff --git a/setup.py b/setup.py index b7cd880..2254fe0 100644 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ import numpy all_extensions = Extension("*", ["pyisda/*.pyx"], include_dirs = ['c_layer', numpy.get_include()], - libraries = ["cds", "cityhash"], + libraries = ["cds", "farmhash"], language = 'c++') c_extension = Extension("pyisda.flat_hazard", -- cgit v1.2.3-70-g09d2