Skip to content

Commit

Permalink
fix dangerous code
Browse files Browse the repository at this point in the history
  • Loading branch information
jtcoolen committed Nov 18, 2023
1 parent c638d97 commit ce484db
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/pari.ml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ module Integer = struct

let shift x s = mpshift x (Signed.Long.of_int s)
let sqrt i = inj_complex (sqrti i)
let zero = of_int 0
let zero () = of_int 0

let mul x y =
let res = mulii x y in
Expand Down Expand Up @@ -340,7 +340,7 @@ module Integer_mod = struct
fun x ->
let x = Ctypes.(coerce gen (ptr gen) x) in
let modulo = Ctypes.(!@(x +@ 1)) in
let res = Ctypes.allocate t Integer.zero in
let res = Ctypes.allocate t (Integer.zero ()) in
if invmod Ctypes.(!@(x +@ 2)) modulo res = 1 then
Some (create Ctypes.(!@res) ~modulo)
else None
Expand Down
2 changes: 1 addition & 1 deletion src/pari.mli
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ and Integer : sig
val equal : t -> t -> bool
val shift : t -> int -> t
val sqrt : t -> Real.t
val zero : t
val zero : unit -> t
val mul : t -> t -> t
val add : t -> t -> t
val sub : t -> t -> t
Expand Down

0 comments on commit ce484db

Please sign in to comment.