KiCad PCB EDA Suite
std::hash< SCALED_BITMAP_ID > Struct Template Reference

Public Types

typedef SCALED_BITMAP_ID argument_type
 
typedef std::size_t result_type
 

Public Member Functions

result_type operator() (argument_type const &id) const noexcept
 

Detailed Description

template<>
struct std::hash< SCALED_BITMAP_ID >

Definition at line 65 of file bitmap.cpp.

Member Typedef Documentation

◆ argument_type

Definition at line 67 of file bitmap.cpp.

◆ result_type

typedef std::size_t std::hash< SCALED_BITMAP_ID >::result_type

Definition at line 68 of file bitmap.cpp.

Member Function Documentation

◆ operator()()

result_type std::hash< SCALED_BITMAP_ID >::operator() ( argument_type const &  id) const
inlinenoexcept

Definition at line 70 of file bitmap.cpp.

71  {
72  static const bool sz64 = sizeof( uintptr_t ) == 8;
73  static const size_t mask = sz64 ? 0xF000000000000000uLL : 0xF0000000uL;
74  static const size_t offset = sz64 ? 60 : 28;
75 
76  // The hash only needs to be fast and simple, not necessarily accurate - a collision
77  // only makes things slower, not broken. BITMAPS is a pointer, so the most
78  // significant several bits are generally going to be the same for all. Just convert
79  // it to an integer and stuff the scale factor into those bits.
80  return
81  ( (uintptr_t)( id.bitmap ) & ~mask ) |
82  ( ( (uintptr_t)( id.scale ) & 0xF ) << offset );
83  }
const int scale

References scale.


The documentation for this struct was generated from the following file: