Beispiel #1
0
void sort_run( indri::file::File& out, indri::file::File& in, size_t memory ) {
  // read the data in
  UINT64 length = in.size();
  char* data = new char[length];
  in.read( data, 0, length );
  in.close();

  qsort( data, length / 12, 12, sort_comparator );

  out.write( data, 0, length );
  delete[] data;
}
Beispiel #2
0
void copy_region( indri::file::File& out, indri::file::File& in, UINT64 position, UINT64 length ) {
  char* buffer = new char[1024*1024];
  UINT64 bufLength = 1024*1024;
  UINT64 total = 0;
  
  while( length > total ) {
    UINT64 chunk = lemur_compat::min<UINT64>( bufLength, length - total );

    in.read( buffer, position + total, chunk );
    out.write( buffer, total, chunk );
    
    total += chunk;
  }
  
  delete[] buffer;
}