Michelson: make maximum integer for gas 32 bit compatible (#169)

This commit is contained in:
Milo Davis 2018-03-15 01:05:31 -04:00 committed by Benjamin Canou
parent 2d9bbcce90
commit 2fbc60af75

View File

@ -232,18 +232,20 @@ module Cost_of = struct
| None -> default
| Some x -> x
let max_int = 1073741823
let shift_left x y =
(alloc_cost @@ words_of_bits @@
let (+) = Pervasives.(+) in
Z.numbits (Script_int.to_zint x) +
(unopt (Script_int.to_int y) ~default:2147483647))
(unopt (Script_int.to_int y) ~default:max_int))
let shift_right x y =
(alloc_cost @@ words_of_bits @@
max 1 @@
let (-) = Pervasives.(-) in
Z.numbits (Script_int.to_zint x) -
unopt (Script_int.to_int y) ~default:2147483647)
unopt (Script_int.to_int y) ~default:max_int)
let exec = step_cost 1