[m-users.] Too Slow

Matthias Guedemann matthias.guedemann at googlemail.com
Sat May 2 23:13:03 AEST 2015


> You call mp_set_int before checking the result from mp_init, which
> could be a problem.

> Rather than return two foreign results it may be nicer to define a
> Mercury enumeration of the possible errors and export it with
> foreign_export_enum (sections 14.5, 14.10.1.2), then create the
> appropriate Mercury value from the C code.

ok, this is done in the attached version of mp_int.m, thank you for the
hint.

With the exception of sqrt, I only provided deterministic predicates and
functions, if any error is encountered, the program aborts with error/1.

This version, together with compiling the library with redefined MALLOC
macros seems to work very well. I'll test a bit more an will provide a
PR for "extras" next week.

Best regards,
Matthias

-------------- next part --------------
A non-text attachment was scrubbed...
Name: mp_int.m
Type: application/octet-stream
Size: 16818 bytes
Desc: not available
URL: <http://lists.mercurylang.org/archives/users/attachments/20150502/43802299/attachment.obj>


More information about the users mailing list