[m-dev.] For review: efficiency improvements to string.m

Fergus Henderson fjh at cs.mu.OZ.AU
Thu Sep 28 05:07:51 AEDT 2000


On 27-Sep-2000, Ralph Becket <rbeck at microsoft.com> wrote:
> Update to NEWS file to follow.  Will commit this if no complaints.
> 
> Efficiency improvements to string.m (mainly changing predicates
> that used the costly string__first_char/3 to cheaper, alternative
> methods).
...
> @@ -1422,6 +1421,16 @@
>  */
>  :- pragma c_code(string__index(Str::in, Index::in, Ch::out),
>  		[will_not_call_mercury, thread_safe], "
> +
> +                /* We do not test for negative values of Index
> +                ** because (a) MR_Word is unsigned and hence a
> +                ** negative argument will appear as a very large
> +                ** positive one after the cast and (b) anybody
> +                ** dealing with the case where strlen(Str) > MAXINT
> +                ** is clearly barking mad (and one may well
> +                ** get an integer overflow error in this case).
> +                */

The "/*" should be on a line of its own, like the "*/".

Otherwise, that change looks great now.

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh>  |  of excellence is a lethal habit"
PGP: finger fjh at 128.250.37.3        |     -- the last words of T. S. Garp.
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list