Changeset 2741


Ignore:
Timestamp:
2001-09-20T14:31:59+12:00 (23 years ago)
Author:
kjm18
Message:

updated mg to be in line with version mg-1.3f. Now uses long long for
some variables to enable indexing of very large collections.

Location:
trunk/gsdl/packages/mg/lib
Files:
1 added
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl/packages/mg/lib/Makefile.in

    r1598 r2741  
    8383    bitio_m_mems.h     bitio_stdio.h      huffman_stdio.h    sptree.h \
    8484    pathmax.h          getpagesize.h \
    85     random.h           simplefrenchstem.h unitool.h
     85    random.h           simplefrenchstem.h unitool.h  longlong.h
    8686# regex.h            rx.h               
    8787
  • trunk/gsdl/packages/mg/lib/WIN32.MAK

    r2338 r2741  
    5454    bitio_m_mems.h     bitio_stdio.h      huffman_stdio.h    sptree.h \
    5555                       rx.h               pathmax.h          getpagesize.h \
    56     random.h           win32in.h          simplefrenchstem.h unitool.h
     56    random.h           win32in.h          simplefrenchstem.h unitool.h \
     57    longlong.h 
    5758
    5859SOURCES = \
  • trunk/gsdl/packages/mg/lib/bitio_gen.c

    r439 r2741  
    2424/*
    2525   $Log$
     26   Revision 1.2  2001/09/21 12:45:03  kjm18
     27   updated mg to be in line with version mg-1.3f. Now uses long long for
     28   some variables to enable indexing of very large collections.
     29
    2630   Revision 1.1  1999/08/10 21:16:42  sjboddie
    2731   renamed mg-1.3d directory mg
     
    131135}
    132136
     137
     138/* adjustment is a hack to overcome inaccuracies in floating point,
     139   where (int)(ln4/ln2) can equal 1, not 2. */
     140/* copied from mg-1.3f, 17-09-01 kjm18 */
    133141int
    134142BIO_Gamma_Bound (int N, int p)
    135143{
    136   return ((int) (p * (2 * log2 ((double) N / p) + 1)));
     144  //return ((int) (p * (2 * log2 ((double) N / p) + 1)));
     145  return ((int) (p * (2 * log2 (((double) N * 1.0001) / p) + 1)));
    137146}
    138147
  • trunk/gsdl/packages/mg/lib/bitio_random.c

    r439 r2741  
    1 /**************************************************************************
     1/*************************************************************************
    22 *
    33 * bitio_random.c -- Functions for bitio to a file (random access)
     
    2424/*
    2525   $Log$
     26   Revision 1.2  2001/09/21 12:45:03  kjm18
     27   updated mg to be in line with version mg-1.3f. Now uses long long for
     28   some variables to enable indexing of very large collections.
     29
    2630   Revision 1.1  1999/08/10 21:16:46  sjboddie
    2731   renamed mg-1.3d directory mg
     
    4246#include "memlib.h"
    4347
     48#include "longlong.h"
     49
    4450#include "bitio_m_random.h"
    4551#include "bitio_m.h"
     
    284290    return (t);
    285291}
     292
     293#ifdef USE_LONG_LONG
     294
     295void
     296BIO_Random_Seek_LL (mg_ullong pos, random_bitio_state * bs)
     297{
     298  ENCODE_CONTINUE(*bs)
     299
     300    if ((((pos) >> 3) >= (mg_ullong)__base) &&
     301    ((((pos)+7) >> 3) < (mg_ullong)(__base + __len)))
     302      {
     303    __pos = (long)((pos) - (mg_ullong)(__base << 3));
     304      }
     305    else
     306      {
     307        ENCODE_FLUSH;
     308    __base = (long)(((pos) >> (__sft+3)) << __sft);
     309   
     310    fseek(__file,__base,0);
     311    fread(__buf,1,__len,__file);
     312    __pos = (long)((pos) & ((8 << __sft)-1));
     313      }
     314 
     315  ENCODE_PAUSE(*bs)
     316}
     317
     318mg_ullong
     319BIO_Random_Tell_LL (random_bitio_state * bs)
     320{
     321  mg_ullong t;
     322  ENCODE_CONTINUE(*bs)
     323    t = (((mg_ullong)__base) << 3ull) + __pos;
     324  ENCODE_PAUSE(*bs)
     325  return(t); 
     326}
     327
     328#endif
  • trunk/gsdl/packages/mg/lib/bitio_random.h

    r439 r2741  
    3030 *  and just continue processing.
    3131 *
     32 *  Modified:
     33 *   - long long seek and tell ops
     34 *     (1999-08-03 Tim Bell <[email protected]>)
    3235 **************************************************************************/
    3336
     
    3538#define H_BITIO_RANDOM
    3639
     40#include "longlong.h"
    3741
    3842
     
    114118unsigned long BIO_Random_Tell (random_bitio_state * bs);
    115119
     120#ifdef USE_LONG_LONG
     121
     122void BIO_Random_Seek_LL (mg_ullong pos, random_bitio_state * bs);
     123mg_ullong BIO_Random_Tell_LL (random_bitio_state * bs);
     124
     125#endif /* USE_LONG_LONG */
    116126
    117127#endif
  • trunk/gsdl/packages/mg/lib/win32in.c

    r439 r2741  
    99
    1010    return x;
     11}
     12
     13mg_ullong ntohll(mg_ullong y)
     14{
     15#if defined (LITTLE_ENDIAN) || defined(_LITTLE_ENDIAN) || defined(__LITTLE_ENDIAN)
     16    x =
     17      ((x >> 56) & 0x00000000000000FF) | ((x >> 40) & 0x000000000000FF00) |
     18      ((x >> 24) & 0x0000000000FF0000) | ((x >> 8)  & 0x00000000FF000000) |
     19      ((x << 8)  & 0x000000FF00000000) | ((x << 24) & 0x0000FF0000000000) |
     20        ((x << 40) & 0x00FF000000000000) | ((x << 56) & 0xFF00000000000000);
     21#endif
     22  return x;
    1123}
    1224
  • trunk/gsdl/packages/mg/lib/win32in.h

    r439 r2741  
    44unsigned long htonl(unsigned long x);
    55unsigned long ntohl(unsigned long x);
     6mg_ullong ntohll(mg_ullong x);
    67unsigned short htons(unsigned short x);
    78unsigned short ntohs(unsigned short x);
Note: See TracChangeset for help on using the changeset viewer.