Changeset 2107 for trunk


Ignore:
Timestamp:
Nov 22, 2012, 9:31:18 AM (8 years ago)
Author:
sam
Message:

core: make hash operators const.

Location:
trunk/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/core/hash.cpp

    r2105 r2107  
    8888 */
    8989
    90 uint32_t Hash<int8_t>::operator ()(int8_t x)
     90uint32_t Hash<int8_t>::operator ()(int8_t x) const
    9191{
    9292    return Hash8((uint8_t)x);
    9393}
    9494
    95 uint32_t Hash<uint8_t>::operator ()(uint8_t x)
     95uint32_t Hash<uint8_t>::operator ()(uint8_t x) const
    9696{
    9797    return Hash8(x);
    9898}
    9999
    100 uint32_t Hash<int16_t>::operator ()(int16_t x)
     100uint32_t Hash<int16_t>::operator ()(int16_t x) const
    101101{
    102102    return Hash16((uint16_t)x);
    103103}
    104104
    105 uint32_t Hash<uint16_t>::operator ()(uint16_t x)
     105uint32_t Hash<uint16_t>::operator ()(uint16_t x) const
    106106{
    107107    return Hash16(x);
    108108}
    109109
    110 uint32_t Hash<int32_t>::operator ()(int32_t x)
     110uint32_t Hash<int32_t>::operator ()(int32_t x) const
    111111{
    112112    return Hash32((uint32_t)x);
    113113}
    114114
    115 uint32_t Hash<uint32_t>::operator ()(uint32_t x)
     115uint32_t Hash<uint32_t>::operator ()(uint32_t x) const
    116116{
    117117    return Hash32(x);
    118118}
    119119
    120 uint32_t Hash<int64_t>::operator ()(int64_t x)
     120uint32_t Hash<int64_t>::operator ()(int64_t x) const
    121121{
    122122    return Hash64((uint64_t)x);
    123123}
    124124
    125 uint32_t Hash<uint64_t>::operator ()(uint64_t x)
     125uint32_t Hash<uint64_t>::operator ()(uint64_t x) const
    126126{
    127127    return Hash64(x);
     
    132132 */
    133133
    134 uint32_t Hash<half>::operator ()(half f)
     134uint32_t Hash<half>::operator ()(half f) const
    135135{
    136136    return Hash16(f.bits);
    137137}
    138138
    139 uint32_t Hash<float>::operator ()(float f)
     139uint32_t Hash<float>::operator ()(float f) const
    140140{
    141141    union { float tmp; uint32_t x; } u = { f };
     
    143143}
    144144
    145 uint32_t Hash<double>::operator ()(double f)
     145uint32_t Hash<double>::operator ()(double f) const
    146146{
    147147    union { double tmp; uint64_t x; } u = { f };
     
    163163}
    164164
    165 uint32_t Hash<char const *>::operator ()(char const *s)
     165uint32_t Hash<char const *>::operator ()(char const *s) const
    166166{
    167167    return HashCharString(s);
    168168}
    169169
    170 uint32_t Hash<String>::operator ()(String const &s)
     170uint32_t Hash<String>::operator ()(String const &s) const
    171171{
    172172    return HashCharString(&s[0]);
  • trunk/src/lol/core/hash.h

    r2105 r2107  
    2323template<typename T> class Hash;
    2424
    25 template<> class Hash<int8_t>   { public: uint32_t operator()(int8_t); };
    26 template<> class Hash<uint8_t>  { public: uint32_t operator()(uint8_t); };
    27 template<> class Hash<int16_t>  { public: uint32_t operator()(int16_t); };
    28 template<> class Hash<uint16_t> { public: uint32_t operator()(uint16_t); };
    29 template<> class Hash<int32_t>  { public: uint32_t operator()(int32_t); };
    30 template<> class Hash<uint32_t> { public: uint32_t operator()(uint32_t); };
    31 template<> class Hash<int64_t>  { public: uint32_t operator()(int64_t); };
    32 template<> class Hash<uint64_t> { public: uint32_t operator()(uint64_t); };
     25template<> class Hash<int8_t>   { public: uint32_t operator()(int8_t) const; };
     26template<> class Hash<uint8_t>  { public: uint32_t operator()(uint8_t) const; };
     27template<> class Hash<int16_t>  { public: uint32_t operator()(int16_t) const; };
     28template<> class Hash<uint16_t> { public: uint32_t operator()(uint16_t) const; };
     29template<> class Hash<int32_t>  { public: uint32_t operator()(int32_t) const; };
     30template<> class Hash<uint32_t> { public: uint32_t operator()(uint32_t) const; };
     31template<> class Hash<int64_t>  { public: uint32_t operator()(int64_t) const; };
     32template<> class Hash<uint64_t> { public: uint32_t operator()(uint64_t) const; };
    3333
    34 template<> class Hash<half>     { public: uint32_t operator()(half); };
    35 template<> class Hash<float>    { public: uint32_t operator()(float); };
    36 template<> class Hash<double>   { public: uint32_t operator()(double); };
    37 template<> class Hash<ldouble>  { public: uint32_t operator()(ldouble); };
     34template<> class Hash<half>     { public: uint32_t operator()(half) const; };
     35template<> class Hash<float>    { public: uint32_t operator()(float) const; };
     36template<> class Hash<double>   { public: uint32_t operator()(double) const; };
     37template<> class Hash<ldouble>  { public: uint32_t operator()(ldouble) const; };
    3838
    3939template<> class Hash<char const *>
    4040{
    4141public:
    42     uint32_t operator()(char const *x);
     42    uint32_t operator()(char const *x) const;
    4343};
    4444
     
    4646{
    4747public:
    48     uint32_t operator()(String const &s);
     48    uint32_t operator()(String const &s) const;
    4949};
    5050
Note: See TracChangeset for help on using the changeset viewer.