Changeset 3bf812b for doc/theses
 Timestamp:
 May 22, 2020, 4:32:11 PM (4 years ago)
 Branches:
 ADT, armeh, astexperimental, enum, forallpointerdecay, jacob/cs343translation, master, newast, newastuniqueexpr, pthreademulation, qualifiedEnum
 Children:
 8e1b1bb
 Parents:
 8f4f3e0
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

doc/theses/thierry_delisle_PhD/code/snzi.hpp
r8f4f3e0 r3bf812b 11 11 std::unique_ptr<snzi_t::node[]> nodes; 12 12 13 snzi_t(unsigned depth );13 snzi_t(unsigned depth, unsigned base = 2); 14 14 15 15 void arrive(int idx) { 16 idx &= mask;16 idx %= mask; 17 17 nodes[idx].arrive(); 18 18 } 19 19 20 20 void depart(int idx) { 21 idx &= mask;21 idx %= mask; 22 22 nodes[idx].depart(); 23 23 } … … 145 145 }; 146 146 147 snzi_t::snzi_t(unsigned depth )148 : mask( (1 << depth)  1)149 , root( (( 1 << depth) * 2)  2)147 snzi_t::snzi_t(unsigned depth, unsigned base) 148 : mask( std::pow(base, depth) ) 149 , root( ((std::pow(base, depth + 1)  1) / (base 1))  1 ) 150 150 , nodes(new node[ root + 1 ]()) 151 151 { 152 int width = (1 <<depth);152 int width = std::pow(base, depth); 153 153 for(int i = 0; i < root; i++) { 154 nodes[i].parent = &nodes[(i / 2) + width ];154 nodes[i].parent = &nodes[(i / base) + width ]; 155 155 } 156 156 }
Note: See TracChangeset
for help on using the changeset viewer.