/usr/include/polybori/groebner/PseudoLongProduct.h is in libpolybori-groebner-dev 0.8.3-3+b2.
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 | // -*- c++ -*-
//*****************************************************************************
/** @file PseudoLongProduct.h
*
* @author Alexander Dreyer
* @date 2012-02-23
*
* This file includes the definition of the class @c PseudoLongProduct.
*
* @par Copyright:
* (c) by The PolyBoRi Team
*
**/
//*****************************************************************************
#ifndef polybori_groebner_PseudoLongProduct_h_
#define polybori_groebner_PseudoLongProduct_h_
// include basic definitions
#include "groebner_defs.h"
#include "PseudoLongLong.h"
#include "BitMask.h"
BEGIN_NAMESPACE_PBORIGB
/** @class PseudoLongProduct
* @brief This class defines a delayed product of longs and comparison with
* @c LongLong Constant.
*
**/
class PseudoLongProduct:
protected BitMask<sizeof(unsigned long)*4> {
public:
typedef unsigned long long_type;
PseudoLongProduct(const long_type& first, const long_type& second):
most(high(first)*high(second)), least(low(first)*low(second)) {
long_type mixed = high(least) + high(first)*low(second);
most += high(mixed);
mixed = low(mixed) + low(first)*high(second);
most += high(mixed);
least = shift(mixed) + low(least);
}
/// compare carry-over savely
bool greater(long_type rhs) const {
return (most > 0) || (least > rhs);
}
/// compare carry-over savely with represented by two unsigned longs
template <long_type MaxLow>
bool greater(const PseudoLongLong<0, MaxLow>&) const {
return greater(MaxLow);
}
/// compare carry-over savely with represented by two unsigned longs
template <long_type MaxHigh, long_type MaxLow>
bool greater(const PseudoLongLong<MaxHigh, MaxLow>&) const {
return (most > MaxHigh) || ( (most == MaxHigh) && (least > MaxLow) );
}
private:
long_type most, least;
};
template <class RhsType>
inline bool
operator> (PseudoLongProduct lhs, const RhsType& rhs) {
return lhs.greater(rhs);
}
END_NAMESPACE_PBORIGB
#endif /* polybori_groebner_PseudoLongProduct_h_ */
|