Changeset 167 for trunk/orca/array.c

Show
Ignore:
Timestamp:
06/04/06 04:58:45 (2 years ago)
Author:
krobillard
Message:

Fixed a couple cases where reading beyond end of buffer.
Optimized ur_arrayErase() when elemSize == 16 and WORDSIZE == 64.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/orca/array.c

    r42 r167  
    127127    else if( elemSize == 16 ) 
    128128    { 
     129#if __WORDSIZE == 64 
     130        uint64_t* buf; 
     131        uint64_t* src; 
     132        uint64_t* end; 
     133 
     134        buf = ((uint64_t*) arr->buf) + (index * 2); 
     135        src = buf + (count * 2); 
     136        end = ((uint64_t*) arr->buf) + (arr->used * 2); 
     137 
     138        while( src != end ) 
     139        { 
     140            *buf++ = *src++; 
     141            *buf++ = *src++; 
     142        } 
     143#else 
    129144        uint32_t* buf; 
    130145        uint32_t* src; 
     
    142157            *buf++ = *src++; 
    143158        } 
     159#endif 
    144160    } 
    145161    else 
     
    147163        char* buf;  
    148164        buf = arr->charArray + (elemSize * index); 
    149         memMove( buf, buf + elemSize, elemSize * (arr->used - index) ); 
     165        memMove( buf, buf + (elemSize * count), 
     166                 elemSize * (arr->used - index - count) ); 
    150167    } 
    151168