| 138224 | // Shifts the current subtree rooted at w+. This is done by increasing |
| 138225 | // prelim(w+) and mod(w+) by shift. |
| 138226 | function moveSubtree(wm, wp, shift) { |
| 138227 | var change = shift / (wp.i - wm.i); |
| 138228 | wp.c -= change; |
| 138229 | wp.s += shift; |
| 138230 | wm.c += change; |
| 138231 | wp.z += shift; |
| 138232 | wp.m += shift; |
| 138233 | } |
| 138234 | // All other shifts, applied to the smaller subtrees between w- and w+, are |
| 138235 | // performed by this function. To prepare the shifts, we have to adjust |
| 138236 | // change(w+), shift(w+), and change(w-). |