/usr/include/polybori/groebner/BitMask.h is in libbrial-groebner-dev 0.8.5-4.
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 | // -*- c++ -*-
//*****************************************************************************
/** @file BitMask.h
*
* @author Alexander Dreyer
* @date 2012-02-23
*
* This file includes the definition of the class @c BitMask.
*
* @par Copyright:
* (c) 2012 by The PolyBoRi Team
*
**/
//*****************************************************************************
#ifndef polybori_groebner_BitMask_h_
#define polybori_groebner_BitMask_h_
// include basic definitions
#include "groebner_defs.h"
BEGIN_NAMESPACE_PBORIGB
/** @class BitMask
* @brief This class defines a bit mask and related operations.
*
**/
template <unsigned NBits>
class BitMask;
template <>
class BitMask<0> {
public:
enum { nbits = 0, mask = (unsigned long)0 };
unsigned long low(const unsigned long& value) const { return 0; }
const unsigned long& high(const unsigned long& value) const { return value; }
const unsigned long& shift(const unsigned long& value) const { return value; }
unsigned long back(const unsigned long& value) const { return 0; }
};
template <unsigned NBits>
class BitMask {
public:
enum { nbits = NBits, mask = ((unsigned long)(BitMask<nbits-1>::mask) << 1) | 0x1};
unsigned long low(const unsigned long& value) const {
return value & mask;
}
unsigned long high(const unsigned long& value) const {
return value >> NBits;
}
unsigned long shift(const unsigned long& value) const {
return value << NBits;
}
unsigned long back(const unsigned long& value) const {
return value << (sizeof(unsigned long)*8 - NBits);
}
};
template <>
class BitMask<sizeof(unsigned long)*8> {
public:
enum { nbits = sizeof(unsigned long)*8,
mask = ((unsigned long)(BitMask<nbits-1>::mask) << 1) | 0x1};
const unsigned long& low(const unsigned long& value) const { return value; }
unsigned long high(const unsigned long& value) const { return 0; }
unsigned long shift(const unsigned long& value) const { return 0; }
const unsigned long& back(const unsigned long& value) const { return value; }
};
END_NAMESPACE_PBORIGB
#endif /* polybori_groebner_BitMask_h_ */
|