Skip to content

Commit

Permalink
Merge pull request #85 from AndrewScheidecker/removed_magic_from_memory
Browse files Browse the repository at this point in the history
Replaced explicit truncation on memory store with implicit truncation+comment
  • Loading branch information
sunfishcode committed Sep 25, 2015
2 parents fdf44d6 + 2312e23 commit 70817af
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion ml-proto/src/spec/memory.ml
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,8 @@ let load64 mem a =
Int64.logor (Int64.of_int32 (load32 mem a)) (Int64.shift_left (Int64.of_int32 (load32 mem (a+4))) 32)

let store8 mem a bits =
!mem.{a} <- Int32.to_int (Int32.logand bits (Int32.of_int 255))
(* Store the lowest 8 bits of "bits" at byte index a, discarding the rest. *)
!mem.{a} <- Int32.to_int bits

let store16 mem a bits =
store8 mem (a+0) bits;
Expand Down

0 comments on commit 70817af

Please sign in to comment.