~ubuntu-branches/ubuntu/trusty/blender/trusty

« back to all changes in this revision

Viewing changes to intern/container/CTR_HashedPtr.h

  • Committer: Package Import Robot
  • Author(s): Jeremy Bicha
  • Date: 2013-03-06 12:08:47 UTC
  • mfrom: (1.5.1) (14.1.8 experimental)
  • Revision ID: package-import@ubuntu.com-20130306120847-frjfaryb2zrotwcg
Tags: 2.66a-1ubuntu1
* Resynchronize with Debian (LP: #1076930, #1089256, #1052743, #999024,
  #1122888, #1147084)
* debian/control:
  - Lower build-depends on libavcodec-dev since we're not
    doing the libav9 transition in Ubuntu yet

Show diffs side-by-side

added added

removed removed

Lines of Context:
30
30
 *  \ingroup ctr
31
31
 */
32
32
 
33
 
#ifndef CTR_HASHEDPTR_H
34
 
#define CTR_HASHEDPTR_H
 
33
#ifndef __CTR_HASHEDPTR_H__
 
34
#define __CTR_HASHEDPTR_H__
35
35
 
36
36
#include <stdlib.h>
37
37
 
38
38
inline unsigned int CTR_Hash(void *inDWord)
39
39
{
40
40
        size_t key = (size_t)inDWord;
41
 
        return (unsigned int)(key ^ (key>>4));
 
41
        return (unsigned int)(key ^ (key >> 4));
42
42
}
43
43
 
44
44
class CTR_HashedPtr
45
45
{
46
 
        void* m_valptr;
 
46
        void *m_valptr;
47
47
public:
48
 
        CTR_HashedPtr(void* val) : m_valptr(val) {};
49
 
        unsigned int hash() const { return CTR_Hash(m_valptr);};
50
 
        inline friend bool operator ==(const CTR_HashedPtr & rhs, const CTR_HashedPtr & lhs) { return rhs.m_valptr == lhs.m_valptr;};
51
 
        void *getValue() const { return m_valptr; }
 
48
        CTR_HashedPtr(void *val) : m_valptr(val) {
 
49
        }
 
50
        unsigned int hash() const {
 
51
                return CTR_Hash(m_valptr);
 
52
        }
 
53
        inline friend bool operator ==(const CTR_HashedPtr & rhs, const CTR_HashedPtr & lhs) {
 
54
                return rhs.m_valptr == lhs.m_valptr;
 
55
        }
 
56
        void *getValue() const {
 
57
                return m_valptr;
 
58
        }
52
59
};
53
60
 
54
 
#endif //CTR_HASHEDPTR_H
 
61
#endif  /* __CTR_HASHEDPTR_H__ */
55
62