-
Notifications
You must be signed in to change notification settings - Fork 2
Open questions
cgeoffroy edited this page Feb 27, 2012
·
1 revision
Some basic questions
(*
# (Int64.sub (Int64.div Int64.max_int (Int64.of_int 2)) (Int64.of_int 100));;
- : int64 = 4611686018427387803L
*)
let f x = 4611686018427387803 + x;;
Printf.printf "='%d'\n" (f (int_of_string Sys.argv.(1)));;
produce:
/tmp/tempo$ocamlc -dinstr a.ml
branch L2
L1: acc 0
push
const 4611686018427387803
addint
return 1
L2: closure L1, 0
push
const 1
push
getglobal Sys!
getfield 0
ccall caml_array_get_addr, 2
ccall caml_int_of_string, 1
push
acc 1
apply 1
push
const "='%d'\n"
push
getglobal Printf!
getfield 1
apply 2
acc 0
makeblock 1, 0
pop 1
setglobal A!
I am not sure that the const 4611686018427387803
instruction will fit in 32 bits.
expected result:
/tmp/tempo$ocamlc a.ml && ./a.out 1
='4611686018427387804'