From 490d24ef415de2a14ea2d657d897ff83595c6bc7 Mon Sep 17 00:00:00 2001 From: David Rose Date: Tue, 24 Apr 2007 14:56:23 +0000 Subject: [PATCH] add get_key() method for Python hashing --- panda/src/putil/bitMask.I | 12 ++++++++++++ panda/src/putil/bitMask.h | 2 ++ 2 files changed, 14 insertions(+) diff --git a/panda/src/putil/bitMask.I b/panda/src/putil/bitMask.I index 0d07e431e2..a947c2752c 100644 --- a/panda/src/putil/bitMask.I +++ b/panda/src/putil/bitMask.I @@ -699,6 +699,18 @@ operator >>= (int shift) { _word >>= shift; } +//////////////////////////////////////////////////////////////////// +// Function: BitMask::get_key +// Access: Published +// Description: Returns a mostly unique integer key per unique +// bitmask, suitable for using in a hash table. +//////////////////////////////////////////////////////////////////// +template +INLINE int BitMask:: +get_key() const { + return (int)_word; +} + //////////////////////////////////////////////////////////////////// // Function: BitMask::generate_hash // Access: Public diff --git a/panda/src/putil/bitMask.h b/panda/src/putil/bitMask.h index dd681e7b40..7de06039f1 100644 --- a/panda/src/putil/bitMask.h +++ b/panda/src/putil/bitMask.h @@ -114,6 +114,8 @@ PUBLISHED: INLINE void operator <<= (int shift); INLINE void operator >>= (int shift); + INLINE int get_key() const; + public: INLINE void generate_hash(ChecksumHashGenerator &hashgen) const;