Skip to content

Commit 70817af

Browse files
committed
Merge pull request #85 from AndrewScheidecker/removed_magic_from_memory
Replaced explicit truncation on memory store with implicit truncation+comment
2 parents fdf44d6 + 2312e23 commit 70817af

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

ml-proto/src/spec/memory.ml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,8 @@ let load64 mem a =
9292
Int64.logor (Int64.of_int32 (load32 mem a)) (Int64.shift_left (Int64.of_int32 (load32 mem (a+4))) 32)
9393

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

9798
let store16 mem a bits =
9899
store8 mem (a+0) bits;

0 commit comments

Comments
 (0)