Commits

camlspotter committed 7bdfebd

better int conversion

  • Participants
  • Parent commits 28b189e

Comments (0)

Files changed (1)

File lib/json_conv.ml

   | _ -> errorf "char_of_json: a char expected")
 
 let int_check name conv = Helper.of_deconstr (function 
-  | Number s -> 
-      let bi = Big_int.big_int_of_string s in
-      begin try conv bi with Failure _ -> errorff "%s_of_json: overflow" name end
+  | Number s -> begin try conv s with Failure _ -> errorff "%s_of_json: overflow" name end
   | _ -> errorff "%s_of_json: Number expected" name)
 
-let int_of_json =
-  int_check "int" Big_int.int_of_big_int
+let int_of_json = int_check "int" int_of_string
 
-let int64_of_json =
-  int_check "int64" Big_int.int64_of_big_int
+let int64_of_json = int_check "int64" Int64.of_string
       
-let int32_of_json =
-  int_check "int32" Big_int.int32_of_big_int
+let int32_of_json = int_check "int32" Int32.of_string
       
-let nativeint_of_json = 
-  int_check "nativeint" Big_int.nativeint_of_big_int
+let nativeint_of_json = int_check "nativeint" Nativeint.of_string
       
 let float_of_json = Helper.of_deconstr (function
   | Number s -> float_of_string s (* CR jfuruse: Maybe wrong *)