Vegastrike 0.5.1 rc1  1.0
Original sources for Vegastrike Evolved
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
VertexCompare Struct Reference

Public Member Functions

bool operator() (const GFXVertex *a, const GFXVertex *b) const
 

Detailed Description

Definition at line 43 of file gl_vertex_list.cpp.

Member Function Documentation

bool VertexCompare::operator() ( const GFXVertex a,
const GFXVertex b 
) const
inline

Definition at line 45 of file gl_vertex_list.cpp.

References a, b, and i.

46  {
47  if ((sizeof(GFXVertex) % sizeof(unsigned int)) != 0) {
48  return memcmp( a, b, sizeof (GFXVertex) ) < 0;
49  } else {
50  // faster memcmp, since it gets unrolled by the compiler
51  const unsigned int *ia = reinterpret_cast<const unsigned int*>(a);
52  const unsigned int *ib = reinterpret_cast<const unsigned int*>(b);
53 
54  for (size_t i=0; i < (sizeof(*a) / sizeof(*ia)); ++i) {
55  if (ia[i] < ib[i])
56  return true;
57  else if (ia[i] > ib[i])
58  return false;
59  }
60 
61  return false;
62  }
63  }

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