/usr/include/NTL/WordVector.h is in libntl-dev 5.4.2-4.1build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 | #ifndef NTL_WordVector__H
#define NTL_WordVector__H
/**************************************************************
A WordVector is functionally similar to
a generic NTL vector of _ntl_ulong.
Be careful! the MaxLength() function does not return
the max length ever set, but rather the max space allocated,
which *may* be more.
The FixLength() facility is not available.
The reason for special-casing is efficiency (of course).
**************************************************************/
#include <NTL/tools.h>
#include <NTL/ZZ.h>
NTL_OPEN_NNS
#ifndef NTL_RANGE_CHECK
#define NTL_WV_RANGE_CHECK_CODE
#else
#define NTL_WV_RANGE_CHECK_CODE if (i < 0 || !rep || i >= long(rep[-1])) RangeError(i);
#endif
// vectors are allocated in chunks of this size
#ifndef NTL_WordVectorMinAlloc
#define NTL_WordVectorMinAlloc (4)
#endif
// vectors are always expanded by at least this ratio
#ifndef NTL_WordVectorExpansionRatio
#define NTL_WordVectorExpansionRatio (1.2)
#endif
// controls initialization during input
#ifndef NTL_WordVectorInputBlock
#define NTL_WordVectorInputBlock 50
#endif
class WordVector {
public:
_ntl_ulong *rep;
void RangeError(long i) const;
WordVector(WordVector& x, INIT_TRANS_TYPE) { rep = x.rep; x.rep = 0; }
WordVector() { rep = 0; }
WordVector(INIT_SIZE_TYPE, long n) { rep = 0; DoSetLength(n); }
WordVector(const WordVector& a) { rep = 0; *this = a; }
WordVector& operator=(const WordVector& a);
~WordVector();
void kill();
void DoSetLength(long n);
void SetLength(long n)
{
_ntl_ulong *x = rep;
if (x && long(x[-2] >> 1) >= n && n >= 0)
x[-1] = n;
else
DoSetLength(n);
}
void ZeroLength() { if (rep) rep[-1] = 0; }
void SetMaxLength(long n);
void QuickSetLength(long n) { rep[-1] = _ntl_ulong(n); }
long length() const { return (!rep) ? 0 : long(rep[-1]); }
long MaxLength() const
{ return (!rep) ? 0 : long(rep[-2] >> 1); }
_ntl_ulong& operator[](long i)
{
NTL_WV_RANGE_CHECK_CODE
return rep[i];
}
const _ntl_ulong& operator[](long i) const
{
NTL_WV_RANGE_CHECK_CODE
return rep[i];
}
_ntl_ulong& operator()(long i) { return (*this)[i-1]; }
const _ntl_ulong& operator()(long i) const { return (*this)[i-1]; }
const _ntl_ulong* elts() const { return rep; }
_ntl_ulong* elts() { return rep; }
static void swap_impl(WordVector& x, WordVector& y);
static void append_impl(WordVector& v, _ntl_ulong a);
static void append_impl(WordVector& v, const WordVector& w);
};
inline void swap(WordVector& x, WordVector& y)
{ WordVector::swap_impl(x, y); }
inline void append(WordVector& v, _ntl_ulong a)
{ WordVector::append_impl(v, a); }
inline void append(WordVector& v, const WordVector& w)
{ WordVector::append_impl(v, w); }
NTL_SNS istream& operator>>(NTL_SNS istream&, WordVector&);
NTL_SNS ostream& operator<<(NTL_SNS ostream&, const WordVector&);
long operator==(const WordVector& a, const WordVector& b);
long operator!=(const WordVector& a, const WordVector& b);
long InnerProduct(const WordVector& a, const WordVector& b);
void ShiftAdd(_ntl_ulong *cp, const _ntl_ulong* ap, long sa, long n);
// cp = cp + (a << n)
long WV_BlockConstructAlloc(WordVector& x, long d, long n);
void WV_BlockConstructSet(WordVector& x, WordVector& y, long i);
long WV_BlockDestroy(WordVector& x);
long WV_storage(long d);
NTL_CLOSE_NNS
#endif
|