Ticket #385: x64.patch

File x64.patch, 3.1 KB (added by James Aylett, 15 years ago)

Patch to enable 64 bit docids and 64 bit termcounts (termpos, valueno left 32 bit)

  • xapian-core/tests/harness/testutils.cc

     
    3030
    3131using namespace std;
    3232
    33 ostream &
    34 operator<<(ostream &os, const vector<unsigned int> &ints)
     33template<class T> ostream &
     34operator<<(ostream &os, const vector<T> &ints)
    3535{
    3636    copy(ints.begin(), ints.end(),
    37          ostream_iterator<unsigned int>(os, ", "));
     37            ostream_iterator<T>(os, ", "));
    3838    return os;
    3939}
    4040
  • xapian-core/tests/harness/testutils.h

     
    2828// ######################################################################
    2929// Useful display operators
    3030
     31template<class T>
    3132std::ostream &operator<<(std::ostream &os,
    32                          const std::vector<unsigned int> &ints);
     33                         const std::vector<T> &ints);
    3334
    3435// ######################################################################
    3536// Useful comparison operators
  • xapian-core/include/xapian/types.h

     
    2121#ifndef XAPIAN_INCLUDED_TYPES_H
    2222#define XAPIAN_INCLUDED_TYPES_H
    2323
     24#define USE_64BIT_DOCID 1
     25#define USE_64BIT_TERMCOUNT 1
     26
    2427namespace Xapian {
    2528
    2629/** A count of documents.
     
    2831 *  This is used to hold values such as the number of documents in a database
    2932 *  and the frequency of a term in the database.
    3033 */
     34#ifdef USE_64BIT_DOCID
     35typedef unsigned long long doccount;
     36#else
    3137typedef unsigned doccount;
     38#endif
    3239
    3340/** A signed difference between two counts of documents.
    3441 *
    3542 *  This is used by the Xapian classes which are STL containers of documents
    3643 *  for "difference_type".
    3744 */
    38 typedef int doccount_diff; /* FIXME: can overflow with more than 2^31 docs. */
     45/* FIXME: can overflow. */
     46#ifdef USE_64BIT_DOCID
     47typedef long long doccount_diff;
     48#else
     49typedef int doccount_diff;
     50#endif
    3951
    4052/** A unique identifier for a document.
    4153 *
    4254 *  Docid 0 is invalid, providing an "out of range" value which can be
    4355 *  used to mean "not a valid document".
    4456 */
     57#ifdef USE_64BIT_DOCID
     58typedef unsigned long long docid;
     59#else
    4560typedef unsigned docid;
     61#endif
    4662
    4763/** A normalised document length.
    4864 *
     
    5874 *
    5975 *  This is used to hold values such as the Within Document Frequency (wdf).
    6076 */
     77#ifdef USE_64BIT_TERMCOUNT
     78typedef unsigned long long termcount;
     79#else
    6180typedef unsigned termcount;
     81#endif
    6282
    6383/** A signed difference between two counts of terms.
    6484 *
    6585 *  This is used by the Xapian classes which are STL containers of terms
    6686 *  for "difference_type".
    6787 */
    68 typedef int termcount_diff; /* FIXME: can overflow with more than 2^31 terms. */
     88/* FIXME: can overflow. */
     89#ifdef USE_64BIT_DOCID
     90typedef long long termcount_diff;
     91#else
     92typedef int termcount_diff;
     93#endif
    6994
    7095/** A term position within a document or query.
    7196 */