This file is indexed.

/usr/include/linbox/vector/bit-vector.h is in liblinbox-dev 1.3.2-1.1build2.

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
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
/* linbox/vector/bit-vector.h
 * Copyright (C) 2003 Bradford Hovinen
 *
 * -------------------------------------------------
 *
 * 
 * ========LICENCE========
 * This file is part of the library LinBox.
 * 
 * LinBox is free software: you can redistribute it and/or modify
 * it under the terms of the  GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 * 
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 * 
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 * ========LICENCE========
 *.
 */

#ifndef __LINBOX_bit_vector_H
#define __LINBOX_bit_vector_H

#include <iterator>
#include <vector>
#include <stdexcept>

#include "linbox/vector/vector-traits.h"

namespace LinBox
{

	/** Binary constant defined both for 32 and 64 bits
	*/
#if (__LINBOX_SIZEOF_LONG == 4)
#define __LINBOX_BITSOF_LONG 32
#define __LINBOX_BITSOF_LONG_MUN 31
#define __LINBOX_LOGOF_SIZE 5
#define __LINBOX_POS_ALL_ONES 0x1F
	const unsigned long __LINBOX_ALL_ONES = static_cast<unsigned long>(-1);
#define __LINBOX_PARITY(s) ParallelParity(s)

	inline bool ParallelParity(unsigned long t) {
		t ^= (t >> 16);
		t ^= (t >> 8);
		t ^= (t >> 4);
		t &= 0xf;
		return bool( (0x6996 >> t) & 0x1);
	}
#elif (__LINBOX_SIZEOF_LONG == 8)
#define __LINBOX_BITSOF_LONG 64
#define __LINBOX_BITSOF_LONG_MUN 63
#define __LINBOX_LOGOF_SIZE 6
#define __LINBOX_POS_ALL_ONES 0x3F
	const unsigned long __LINBOX_ALL_ONES = static_cast<unsigned long>(-1);
#define __LINBOX_PARITY(s) ParallelParity(s)

	inline bool ParallelParity(unsigned long t) {
		t ^= (t >> 32);
		t ^= (t >> 16);
		t ^= (t >> 8);
		t ^= (t >> 4);
		t &= 0xf;
		return bool( (0x6996 >> t) & 0x1);
	}
#else
#pragma message "error SIZEOF_LONG not defined !"
#endif

	/** A vector of boolean 0-1 values, stored compactly to save space.
	 *
	 * BitVector provides an additional iterator, word_iterator, that gives
	 * the bits in compact 32-bit words, so that vector operations may be done in
	 * parallel. It is similar to the STL bit_vector except that it provides the
	 * aforementioned additional iterator.
	 \ingroup vector
	 */

	class BitVector {
	public:
		typedef bool        value_type;
		typedef size_t      size_type;
		typedef long         difference_type;
		typedef std::vector<unsigned long>::iterator               word_iterator;
		typedef std::vector<unsigned long>::const_iterator         const_word_iterator;
		typedef std::vector<unsigned long>::reverse_iterator       reverse_word_iterator;
		typedef std::vector<unsigned long>::const_reverse_iterator const_reverse_word_iterator;

		BitVector () {}
		BitVector (std::vector<bool> &v)
		{ *this = v; }
		BitVector (std::vector<unsigned long> &v) :
		       	_v (v), _size (_v.size () * __LINBOX_BITSOF_LONG) {}
		BitVector (size_t n, bool val = false)
		{ resize (n, val); }

		// Copy constructor
		BitVector (const BitVector &v) :
		       	_v (v._v), _size (v._size) {}

		~BitVector () {}

		// Reference

		class reference;
		class const_reference;

		// Iterators

		class iterator;
		class const_iterator;

		typedef std::reverse_iterator<iterator> reverse_iterator;
		typedef std::reverse_iterator<const_iterator> const_reverse_iterator;

		typedef iterator    pointer;
		typedef const_iterator    const_pointer;

		inline iterator                    begin      (void);
		inline const_iterator              begin      (void) const;
		inline iterator                    end        (void);
		inline const_iterator              end        (void) const;

		inline reverse_iterator            rbegin     (void);
		inline const_reverse_iterator      rbegin     (void) const;
		inline reverse_iterator            rend       (void);
		inline const_reverse_iterator      rend       (void) const;

		inline word_iterator               wordBegin  (void)       { return _v.begin (); }
		inline const_word_iterator         wordBegin  (void) const { return _v.begin (); }
		inline word_iterator               wordEnd    (void)       { return _v.end (); }
		inline const_word_iterator         wordEnd    (void) const { return _v.end (); }

		inline reverse_word_iterator       wordRbegin (void)       { return _v.rbegin (); }
		inline const_reverse_word_iterator wordRbegin (void) const { return _v.rbegin (); }
		inline reverse_word_iterator       wordRend   (void)       { return _v.rend (); }
		inline const_reverse_word_iterator wordRend   (void) const { return _v.rend (); }

		// Element access

		inline reference       operator[] (size_type n);
		inline const_reference operator[] (size_type n) const;

		reference at       (size_type n);
		const_reference at (size_type n) const;

		inline reference       front (void);
		inline const_reference front (void) const;
		inline reference       back  (void);
		inline const_reference back  (void) const;

		template<class Container>
		BitVector &operator = (const Container& x);

		void resize (size_type new_size, bool val = false);

		inline size_type size      (void) const { return _size;            }
		inline bool      empty     (void) const { return _v.empty ();      }
		inline size_type max_size  (void) const { return _v.size  () * __LINBOX_BITSOF_LONG; }

		bool operator == (const BitVector &v) const;

	protected:

		std::vector<unsigned long> _v;
		size_t              _size;

	}; // template <class Vector> class ReverseVector

	// Vector traits for BitVector wrapper
	template <>
	struct VectorTraits<BitVector>
	{
		typedef BitVector VectorType;
		typedef VectorCategories::DenseZeroOneVectorTag VectorCategory;
	};

} // namespace LinBox

// RawVector for GF2
namespace LinBox
{
	template <>
	struct RawVector<bool> {
	public:
		typedef BitVector Dense;
		typedef std::vector<size_t> Sparse;
		typedef std::vector<size_t> SparseSeq;
		typedef std::vector<size_t> SparseMap;
		typedef std::vector<size_t> SparsePar;
	};

}
#include "linbox/vector/bit-vector.inl"

#endif // __LINBOX_bit_vector_H


// vim:sts=8:sw=8:ts=8:noet:sr:cino=>s,f0,{0,g0,(0,:0,t0,+0,=s
// Local Variables:
// mode: C++
// tab-width: 8
// indent-tabs-mode: nil
// c-basic-offset: 8
// End: