MCPcopy Create free account
hub / github.com/Gecode/gecode / resize

Method resize

gecode/kernel/core.hpp:4361–4387  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4359
4360 template<class VIC>
4361 forceinline void
4362 VarImp<VIC>::resize(Space& home) {
4363 if (b.base == nullptr) {
4364 assert((free_and_bits >> free_bits) == 0);
4365 // Create fresh dependency array with four entries
4366 free_and_bits += 4 << free_bits;
4367 b.base = home.alloc<ActorLink*>(4);
4368 for (int i=0; i<pc_max+1; i++)
4369 u.idx[i] = 0;
4370 } else {
4371 // Resize dependency array
4372 unsigned int n = degree();
4373 // Find out whether the area is most likely in the special area
4374 // reserved for subscriptions. If yes, just resize mildly otherwise
4375 // more aggressively
4376 ActorLink** s = static_cast<ActorLink**>(home.mm.subscriptions());
4377 unsigned int m =
4378 ((s <= b.base) && (b.base < s+home.pc.p.n_sub)) ?
4379 (n+4) : ((n+1)*3>>1);
4380 ActorLink** prop = home.alloc<ActorLink*>(m);
4381 free_and_bits += (m-n) << free_bits;
4382 // Copy entries
4383 Heap::copy<ActorLink*>(prop, b.base, n);
4384 home.free<ActorLink*>(b.base,n);
4385 b.base = prop;
4386 }
4387 }
4388
4389 template<class VIC>
4390 forceinline void

Callers 5

addMethod · 0.45
parseQDIMACSMethod · 0.45
listAssignmentsFunction · 0.45
addMethod · 0.45
mainFunction · 0.45

Calls 2

degreeFunction · 0.85
subscriptionsMethod · 0.80

Tested by

no test coverage detected