Skip to content

Commit

Permalink
Update defm_test.exs
Browse files Browse the repository at this point in the history
  • Loading branch information
jackalcooper committed Nov 12, 2024
1 parent f939796 commit 85d01d1
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions test/defm_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,20 @@ defmodule AddTwoInt do
alias Charms.{Pointer, Term}

defm add_or_error(env, a, b, error) :: Term.t() do
ptr_a = Pointer.allocate(i64())
ptr_b = Pointer.allocate(i64())
ptr_a = Pointer.allocate(i32())
ptr_b = Pointer.allocate(i32())

arg_err =
block do
func.return(error)
end

cond_br enif_get_int64(env, a, ptr_a) != 0 do
cond_br 0 != enif_get_int64(env, b, ptr_b) do
a = Pointer.load(i64(), ptr_a)
b = Pointer.load(i64(), ptr_b)
sum = value llvm.add(a, b) :: i64()
term = enif_make_int64(env, sum)
cond_br 0 != enif_get_int(env, b, ptr_b) do
a = Pointer.load(i32(), ptr_a)
b = Pointer.load(i32(), ptr_b)
sum = value llvm.add(a, b) :: i32()
term = enif_make_int(env, sum)
func.return(term)
else
^arg_err
Expand Down

0 comments on commit 85d01d1

Please sign in to comment.