+
+ void update(T& entry, int bonus, const int D) {
+
+ assert(abs(bonus) <= D); // Ensure range is [-32 * D, 32 * D]
+ assert(abs(32 * D) < INT16_MAX); // Ensure we don't overflow
+
+ entry += bonus * 32 - entry * abs(bonus) / D;
+
+ assert(abs(entry) <= 32 * D);
+ }