Thanks! Good catch.

  George

On Nov 16, 2010, at 18:26, Tim Mattox <timat...@open-mpi.org> wrote:

> I see a bug in this code fragment:
> 
> +#define MEMMOVE(d, s, l)                                  \
> +    do {                                                  \
> +        if( (((d) < (s)) && (((d) + (l)) > (s))) ||       \
> +            (((s) < (d)) && (((s) + (l)) > (s))) ) {      \
> +            memmove( (d), (s), (l) );                     \
> +        } else {                                          \
> +            MEMCPY( (d), (s), (l) );                      \
> +        }                                                 \
> +    } while (0)
> 
> Shouldn't this line
> +            (((s) < (d)) && (((s) + (l)) > (s))) ) {      \
> 
> be like this instead?
> +            (((s) < (d)) && (((s) + (l)) > (d))) ) {      \
> 
> On Fri, Nov 12, 2010 at 6:22 PM,  <bosi...@osl.iu.edu> wrote:
>> Author: bosilca
>> Date: 2010-11-12 18:22:35 EST (Fri, 12 Nov 2010)
>> New Revision: 24047
>> URL: https://svn.open-mpi.org/trac/ompi/changeset/24047
>> 
>> Log:
>> Add a second version of the datatype copy function using memmove instead of 
>> memcpy.
>> As memmove is slower than memcpy, I added the required logic to only use it 
>> when
>> really necessary.
>> 
>> No modification from developers point of view, you should always call
>> opal_datatype_copy_content_same_ddt.
>> 
>> 
>> Added:
>>   trunk/opal/datatype/opal_datatype_copy.h
>> Text files modified:
>>   trunk/opal/datatype/Makefile.am            |     3
>>   trunk/opal/datatype/opal_datatype_copy.c   |   253 
>> +++++++--------------------------------
>>   trunk/opal/datatype/opal_datatype_memcpy.h |    28 ----
>>   3 files changed, 48 insertions(+), 236 deletions(-)
>> 
>> Modified: trunk/opal/datatype/Makefile.am
> [snip]
> 
> -- 
> Tim Mattox, Ph.D. - http://homepage.mac.com/tmattox/
>  timat...@open-mpi.org || tmat...@gmail.com
>     I'm a bright... http://www.the-brights.net/
> 
> _______________________________________________
> devel mailing list
> de...@open-mpi.org
> http://www.open-mpi.org/mailman/listinfo.cgi/devel

Reply via email to