Alpha: better spreading of roll storage
This greatly reduces the time spent reading roll, while it only slightly increase the time spent while 'freezing' rolls at the end of a cycle.
This commit is contained in:
parent
485d8bc26a
commit
7bd5ef32d9
@ -25,11 +25,10 @@ let (=) = Compare.Int32.(=)
|
||||
module Index = struct
|
||||
type t = roll
|
||||
let path_length = 3
|
||||
let nbyte_of_int32 i n =
|
||||
Int32.to_string @@
|
||||
Int32.logand (Int32.shift_right i (8 * n)) (Int32.of_int 0xff)
|
||||
let to_path roll l =
|
||||
nbyte_of_int32 roll 0 :: nbyte_of_int32 roll 1 :: Int32.to_string roll :: l
|
||||
(Int32.to_string @@ Int32.logand roll (Int32.of_int 0xff)) ::
|
||||
(Int32.to_string @@ Int32.logand (Int32.shift_right_logical roll 8) (Int32.of_int 0xff)) ::
|
||||
Int32.to_string roll :: l
|
||||
let of_path = function
|
||||
| _ :: _ :: s :: _ -> begin
|
||||
try Some (Int32.of_string s)
|
||||
|
Loading…
Reference in New Issue
Block a user