Counter Strike : Global Offensive Source Code
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
1.0 KiB

  1. //====== Copyright Valve Corporation, All rights reserved. =======
  2. #ifndef GOTV_HTTP_STREAM_HDR
  3. #define GOTV_HTTP_STREAM_HDR
  4. #include "tier1/utlhashtable.h"
  5. struct GotvHttpStreamId_t
  6. {
  7. GotvHttpStreamId_t()
  8. {
  9. m_nMatchId = 0;
  10. m_nInstanceId = 0;
  11. }
  12. uint64 m_nMatchId ;
  13. uint m_nInstanceId;
  14. bool operator < ( const GotvHttpStreamId_t &right ) const
  15. {
  16. return m_nMatchId == right.m_nMatchId ? m_nInstanceId < right.m_nInstanceId : m_nMatchId < right.m_nMatchId;
  17. }
  18. bool operator == ( const GotvHttpStreamId_t &right ) const
  19. {
  20. return m_nMatchId == right.m_nMatchId && m_nInstanceId == right.m_nInstanceId;
  21. }
  22. };
  23. // the match id is already a hash (guid) consisting of a random upper uint32 and a counter in lower uint32. So we could actually conceivably use the lower uint32
  24. template <> struct DefaultHashFunctor< GotvHttpStreamId_t > { unsigned int operator()( const GotvHttpStreamId_t &id ) const { return Mix64HashFunctor().operator()( (id.m_nMatchId << 1) + id.m_nInstanceId ); } };
  25. #endif // DEMO_STREAM_HDR