It doesn't seem to affect things in a way that I can measure, though thankfully with Artyom's suggestions the code is now as fast as C (or at least, I can't reliably measure any difference in the two) :)
On 07/20/2018 08:39 AM, gmhwxi wrote:
> fun loop2 { i : nat | i > 0 && i <= n+1 } .<n-i+1>. (x : int(i)) :
> void =
> if x <= sz2i(s2_l) then
> {
> val () = column[0] := x
> val p0 = arrayref2ptr(column)
> val p1 = ptr_succ<int>(p0)
> val () = let
> fun
> inner_loop
> { j : nat | j > 0 && j <= m+1 } .<m-j+1>.
> (y : int(j), p0: ptr, p1: ptr, last_diag : int) : void =
> if y <= sz2i(s1_l) then
> let
> fun min_3(x : int, y : int, z : int) : int = min(x,
> (min(y, z)))
>
> val c0 = $UN.ptr0_get<int>(p0)
> val c1 = $UN.ptr0_get<int>(p1)
> val c1_new = min_3(c0+1, c1+1, last_diag +
> bool2int(s1[y - 1]=s2[x - 1]))
> val () = $UN.ptr0_set<int>(p1, c1_new)
> in
> inner_loop(y + 1, p1, ptr_succ<int>(p1), c1)
> end
>
> inner_loop(1, p0, p1, x - 1)
> end
> val () = loop2(x + 1)
> }
--
You received this message because you are subscribed to the Google Groups
"ats-lang-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/ats-lang-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/ats-lang-users/108e32af-a016-2735-1307-9984df9a334f%40iohk.io.
signature.asc
Description: OpenPGP digital signature
