Krita Source Code Documentation
Loading...
Searching...
No Matches
Leapfrog< Map >::Table Struct Reference

#include <leapfrog.h>

Public Member Functions

void destroy ()
 
CellGroupgetCellGroups () const
 
quint64 getNumMigrationUnits () const
 
 Table (quint64 sizeMask)
 

Static Public Member Functions

static Tablecreate (quint64 tableSize)
 

Public Attributes

SimpleJobCoordinator jobCoordinator
 
QMutex mutex
 
const quint64 sizeMask
 

Detailed Description

template<class Map>
struct Leapfrog< Map >::Table

Definition at line 51 of file leapfrog.h.

Constructor & Destructor Documentation

◆ Table()

template<class Map >
Leapfrog< Map >::Table::Table ( quint64 sizeMask)
inline

Definition at line 56 of file leapfrog.h.

57 {
58 }
const quint64 sizeMask
Definition leapfrog.h:52

Member Function Documentation

◆ create()

template<class Map >
static Table * Leapfrog< Map >::Table::create ( quint64 tableSize)
inlinestatic

Definition at line 60 of file leapfrog.h.

61 {
62#ifdef SANITY_CHECK
64 KIS_ASSERT_RECOVER_NOOP(tableSize >= 4);
65#endif // SANITY_CHECK
66 quint64 numGroups = tableSize >> 2;
67 Table* table = (Table*) std::malloc(sizeof(Table) + sizeof(CellGroup) * numGroups);
68 new (table) Table(tableSize - 1);
69
70 for (quint64 i = 0; i < numGroups; i++) {
71 CellGroup* group = table->getCellGroups() + i;
72
73 for (quint64 j = 0; j < 4; j++) {
74 group->deltas[j].storeNonatomic(0);
75 group->deltas[j + 4].storeNonatomic(0);
76 group->cells[j].hash.storeNonatomic(KeyTraits::NullHash);
77 group->cells[j].value.storeNonatomic(Value(ValueTraits::NullValue));
78 }
79 }
80 return table;
81 }
#define KIS_ASSERT_RECOVER_NOOP(cond)
Definition kis_assert.h:97
bool isPowerOf2(quint64 v)
Definition map_traits.h:29
Table(quint64 sizeMask)
Definition leapfrog.h:56
Map::Value Value
Definition leapfrog.h:23

References Leapfrog< Map >::CellGroup::cells, Leapfrog< Map >::CellGroup::deltas, Leapfrog< Map >::Table::getCellGroups(), Leapfrog< Map >::Cell::hash, isPowerOf2(), KIS_ASSERT_RECOVER_NOOP, Atomic< T >::storeNonatomic(), Leapfrog< Map >::Table::Table(), and Leapfrog< Map >::Cell::value.

◆ destroy()

template<class Map >
void Leapfrog< Map >::Table::destroy ( )
inline

Definition at line 83 of file leapfrog.h.

84 {
85 this->Table::~Table();
86 std::free(this);
87 }

◆ getCellGroups()

template<class Map >
CellGroup * Leapfrog< Map >::Table::getCellGroups ( ) const
inline

Definition at line 89 of file leapfrog.h.

90 {
91 return (CellGroup*)(this + 1);
92 }

◆ getNumMigrationUnits()

template<class Map >
quint64 Leapfrog< Map >::Table::getNumMigrationUnits ( ) const
inline

Definition at line 94 of file leapfrog.h.

95 {
97 }
static const quint64 TableMigrationUnitSize
Definition leapfrog.h:28

References Leapfrog< Map >::Table::sizeMask, and Leapfrog< Map >::TableMigrationUnitSize.

Member Data Documentation

◆ jobCoordinator

template<class Map >
SimpleJobCoordinator Leapfrog< Map >::Table::jobCoordinator

Definition at line 54 of file leapfrog.h.

◆ mutex

template<class Map >
QMutex Leapfrog< Map >::Table::mutex

Definition at line 53 of file leapfrog.h.

◆ sizeMask

template<class Map >
const quint64 Leapfrog< Map >::Table::sizeMask

Definition at line 52 of file leapfrog.h.


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