MCPcopy Create free account
hub / github.com/RcppCore/Rcpp / add_value

Method add_value

inst/include/Rcpp/hash/IndexHash.h:169–187  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

167 }
168
169 bool add_value(int i){
170 RCPP_DEBUG_2( "%s::add_value(%d)", DEMANGLE(IndexHash), i )
171 STORAGE val = normalize(src[i++]);
172 uint32_t addr = get_addr(val) ;
173 while (data[addr] && not_equal( src[data[addr] - 1], val)) {
174 addr++;
175 if (addr == static_cast<uint32_t>(m)) {
176 addr = 0;
177 }
178 }
179
180 if (!data[addr]){
181 data[addr] = i ;
182 size_++ ;
183
184 return true ;
185 }
186 return false;
187 }
188
189 /* NOTE: we are returning a 1-based index ! */
190 inline uint32_t get_index(STORAGE value) const {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected