Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 24 additions & 5 deletions pyci/include/pyci.h
Original file line number Diff line number Diff line change
Expand Up @@ -117,14 +117,15 @@ inline int Ctz(const unsigned long long t) {
}

/* Hash function. */

typedef std::pair<ulong, ulong> Hash;
typedef std::pair<uint64_t, uint64_t> Hash;

template<typename T, typename U>
Hash spookyhash(T length, const U *data) {
Hash h(0x23a23cf5033c3c81UL, 0xb3816f6a2c68e530UL);
SpookyHash::Hash128(reinterpret_cast<const void *>(data), length * sizeof(U), &h.first, &h.second);
return h;
Hash h(0x23a23cf5033c3c81ULL, 0xb3816f6a2c68e530ULL); // Use ULL suffix for unsigned long long
uint64_t first = h.first;
uint64_t second = h.second;
SpookyHash::Hash128(reinterpret_cast<const void *>(data), length * sizeof(U), &first, &second);
return Hash(first, second);
}

/* Vector template types. */
Expand All @@ -135,6 +136,24 @@ using Vector = std::vector<T>;
template<typename T>
using AlignedVector = std::vector<T, Eigen::aligned_allocator<T>>;

}
// typedef std::pair<ulong, ulong> Hash;

// template<typename T, typename U>
// Hash spookyhash(T length, const U *data) {
// Hash h(0x23a23cf5033c3c81UL, 0xb3816f6a2c68e530UL);
// SpookyHash::Hash128(reinterpret_cast<const void *>(data), length * sizeof(U), &h.first, &h.second);
// return h;
// }

// /* Vector template types. */

// template<typename T>
// using Vector = std::vector<T>;

// template<typename T>
// using AlignedVector = std::vector<T, Eigen::aligned_allocator<T>>;

/* Eigen dense matrix template types. */

#define PYCI_MAT_DYNAMIC Eigen::Dynamic, Eigen::Dynamic
Expand Down
Loading