Skip to content

Commit

Permalink
next id is sqrt of range rather than half; seems less wasteful of id …
Browse files Browse the repository at this point in the history
…space
  • Loading branch information
duckpilot committed Apr 20, 2010
1 parent 2302be9 commit e0d4c01
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/froc/froc_timestamp.ml
Expand Up @@ -100,7 +100,11 @@ let renumber t =
let tick () =
let t = !now in
check t;
let id = t.id + (t.next.id - t.id) / 2 in
let next_id = t.next.id in
let id =
let incr = int_of_float (sqrt (float_of_int (next_id - t.id))) in
let id = t.id + incr in
if id = next_id then t.id else id in (* be careful of sqrt(1) = 1; t'.id must = t.id *)
let t' = { id = id; spliced_out = false; next = t.next; prev = t; cleanup = [] } in
t.next.prev <- t';
t.next <- t';
Expand Down

0 comments on commit e0d4c01

Please sign in to comment.