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

#include <common.h>

Public Member Functions

size_t operator() (const wxPoint &k) const
 

Detailed Description

template<>
struct std::hash< wxPoint >

Definition at line 377 of file common.h.

Member Function Documentation

◆ operator()()

size_t std::hash< wxPoint >::operator() ( const wxPoint &  k) const

Definition at line 595 of file common.cpp.

596 {
597  auto xhash = std::hash<int>()( k.x );
598 
599  // 0x9e3779b9 is 2^33 / ( 1 + sqrt(5) )
600  // Adding this value ensures that consecutive bits of y will not be close to each other
601  // decreasing the likelihood of hash collision in similar values of x and y
602  return xhash ^ ( std::hash<int>()( k.y ) + 0x9e3779b9 + ( xhash << 6 ) + ( xhash >> 2 ) );
603 }

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