30 static bool div_cache(
const FixedPoint &a, uint64_t b);
31 static bool div_cache(uint64_t a,
const FixedPoint &b);
43 static int64_t sign_extend(uint64_t d,
size_t n_digits);
524 virtual explicit operator bool()
const;
529 virtual explicit operator int8_t()
const;
534 virtual explicit operator uint8_t()
const;
539 virtual explicit operator int16_t()
const;
544 virtual explicit operator uint16_t()
const;
549 virtual explicit operator int32_t()
const;
554 virtual explicit operator uint32_t()
const;
559 virtual explicit operator int64_t()
const;
564 virtual explicit operator uint64_t()
const;
569 virtual explicit operator double()
const;
709 template <
class Archive>
710 void save(Archive &ar, std::uint32_t
const version)
const {
711 ar(cereal::make_nvp(
"data", data));
712 ar(cereal::make_nvp(
"size", size));
713 ar(cereal::make_nvp(
"sign", sign));
716 template <
class Archive>
717 void load(Archive &ar, std::uint32_t
const version) {
718 if (version > SerializedVersion()) {
719 OPENFHE_THROW(
"serialized object version " +
720 std::to_string(version) +
721 " is from a later version of the library");
723 ar(cereal::make_nvp(
"data", data));
724 ar(cereal::make_nvp(
"size", size));
725 ar(cereal::make_nvp(
"sign", sign));
728 std::string SerializedObjectName()
const override {
return "Einteger"; }
730 static uint32_t SerializedVersion() {
return 1; }
756 template <
typename T,
size_t BITS,
bool SIGNED>
770 EInt(T d = 0) :
Einteger((uint64_t)d, BITS) { this->sign = SIGNED; }
Defines core enumerations and helper functions for ComputeFHE configuration.
const Einteger operator==(double a, const Efixedpoint &b)
const Einteger operator>(double a, const Efixedpoint &b)
ostream & operator<<(ostream &out, const Efixedpoint &obj)
const Efixedpoint operator+(double a, const Efixedpoint &b)
const Einteger operator>=(double a, const Efixedpoint &b)
const Efixedpoint operator*(double a, const Efixedpoint &b)
const Einteger operator!=(double a, const Efixedpoint &b)
const Einteger operator<(double a, const Efixedpoint &b)
const Efixedpoint operator/(double a, const Efixedpoint &b)
const Einteger operator<=(double a, const Efixedpoint &b)
const Efixedpoint operator-(double a, const Efixedpoint &b)
const Einteger operator|(uint64_t a, const Einteger &b)
const Einteger operator^(uint64_t a, const Einteger &b)
const Einteger operator&(uint64_t a, const Einteger &b)
const Einteger operator&&(uint64_t a, const Einteger &b)
const Einteger operator%(uint64_t a, const Einteger &b)
const Einteger operator||(uint64_t a, const Einteger &b)
Defines the fundamental bit-level and bit-vector data structures for FHE operations.
Template class for fixed-size encrypted integers.
Definition Einteger.h:768
Represents an encrypted integer.
Definition Einteger.h:27
virtual const Einteger operator^=(uint64_t)
Encrypted bitwise XOR assignment with a plaintext uint64_t.
virtual const Einteger operator>(uint64_t) const
Encrypted greater-than comparison with a plaintext uint64_t.
virtual const Einteger operator|=(const Einteger &)
Encrypted bitwise OR assignment with another Einteger.
virtual const Einteger operator/(const Einteger &) const
Encrypted division with another Einteger.
virtual const Einteger operator||(const Einteger &) const
Encrypted logical OR with another Einteger.
virtual const Einteger operator*=(const Einteger &)
Encrypted multiplication assignment with another Einteger.
virtual const Einteger operator/=(const Einteger &)
Encrypted division assignment with another Einteger.
virtual const Einteger operator|=(uint64_t)
Encrypted bitwise OR assignment with a plaintext uint64_t.
const Einteger operator>>(int) const
Encrypted right shift.
virtual const Einteger operator/=(uint64_t)
Encrypted division assignment with a plaintext uint64_t.
virtual const Einteger operator|(uint64_t) const
Encrypted bitwise OR with a plaintext uint64_t.
virtual const Einteger operator|(const Einteger &) const
Encrypted bitwise OR with another Einteger.
friend const Einteger operator>(uint64_t a, const Einteger &b)
Friend operator for plaintext uint64_t greater-than comparison with Einteger.
virtual const Einteger operator*(const Einteger &) const
Encrypted multiplication with another Einteger.
friend const Einteger operator>=(uint64_t a, const Einteger &b)
Friend operator for plaintext uint64_t greater-than-or-equal comparison with Einteger.
Einteger & operator=(uint64_t)
Assignment operator from a plaintext uint64_t.
const Einteger operator--()
Pre-decrement operator. Decrements the encrypted integer by one.
friend const Einteger operator&(uint64_t a, const Einteger &b)
Friend operator for plaintext uint64_t bitwise AND with Einteger.
friend const Einteger operator/(uint64_t a, const Einteger &b)
Friend operator for plaintext uint64_t division with Einteger.
virtual const Einteger operator-=(const Einteger &)
Encrypted subtraction assignment with another Einteger.
friend const Einteger operator==(uint64_t a, const Einteger &b)
Friend operator for plaintext uint64_t equality comparison with Einteger.
virtual const Einteger operator+(const Einteger &) const
Encrypted addition with another Einteger.
virtual const Einteger operator%=(const Einteger &)
Encrypted modulo assignment with another Einteger.
virtual const Einteger operator>=(const Einteger &) const
Encrypted greater-than-or-equal comparison with another Einteger.
virtual const Einteger operator<(const Einteger &) const
Encrypted less-than comparison with another Einteger.
bool isSigned() const
Checks if the encrypted integer is signed.
const Einteger operator++(int)
Post-increment operator. Increments the encrypted integer by one.
virtual const Einteger operator!() const
Encrypted logical NOT.
virtual const Einteger operator+=(const Einteger &)
Encrypted addition assignment with another Einteger.
virtual const Einteger operator/(uint64_t) const
Encrypted division with a plaintext uint64_t.
virtual const Einteger operator!=(const Einteger &) const
Encrypted inequality comparison with another Einteger.
virtual const Einteger operator+=(uint64_t)
Encrypted addition assignment with a plaintext uint64_t.
virtual const Einteger operator^(const Einteger &) const
Encrypted bitwise XOR with another Einteger.
virtual const Einteger operator&=(const Einteger &)
Encrypted bitwise AND assignment with another Einteger.
friend const Einteger operator+(uint64_t a, const Einteger &b)
Friend operator for plaintext uint64_t addition with Einteger.
virtual const Einteger operator<=(const Einteger &) const
Encrypted less-than-or-equal comparison with another Einteger.
virtual const Einteger operator%=(uint64_t)
Encrypted modulo assignment with a plaintext uint64_t.
virtual const Einteger operator+(uint64_t) const
Encrypted addition with a plaintext uint64_t.
size_t getSize() const
Gets the number of bits used to represent the encrypted integer.
virtual const Einteger operator^=(const Einteger &)
Encrypted bitwise XOR assignment with another Einteger.
virtual const Einteger operator==(const Einteger &) const
Encrypted equality comparison with another Einteger.
virtual const Einteger operator-(uint64_t) const
Encrypted subtraction with a plaintext uint64_t.
virtual const Einteger operator!=(uint64_t) const
Encrypted inequality comparison with a plaintext uint64_t.
friend const Einteger operator&&(uint64_t a, const Einteger &b)
Friend operator for plaintext uint64_t logical AND with Einteger.
const Einteger operator++()
Pre-increment operator. Increments the encrypted integer by one.
virtual const Einteger operator||(uint64_t) const
Encrypted logical OR with a plaintext uint64_t.
Einteger(const Einteger &other)
Copy constructor.
Einteger()
Default constructor. Initializes an empty or zero-valued encrypted integer.
virtual const Einteger operator-(const Einteger &) const
Encrypted subtraction with another Einteger.
virtual ~Einteger()
Destructor.
Einteger(const FixedPoint &fp, bool is_signed)
Constructs an Einteger from an existing FixedPoint object.
const Einteger operator<<=(int)
Encrypted left shift assignment.
virtual const Einteger operator&=(uint64_t)
Encrypted bitwise AND assignment with a plaintext uint64_t.
friend const Einteger operator|(uint64_t a, const Einteger &b)
Friend operator for plaintext uint64_t bitwise OR with Einteger.
const Einteger operator--(int)
Post-decrement operator. Decrements the encrypted integer by one.
virtual const Einteger operator*=(uint64_t)
Encrypted multiplication assignment with a plaintext uint64_t.
friend const Einteger operator<=(uint64_t a, const Einteger &b)
Friend operator for plaintext uint64_t less-than-or-equal comparison with Einteger.
Einteger(int64_t d, size_t n_digits)
Constructs an Einteger from a plaintext int64_t with a specified number of bits.
virtual const Einteger operator>(const Einteger &) const
Encrypted greater-than comparison with another Einteger.
Einteger & operator=(const Einteger &)
Assignment operator from another Einteger.
virtual const Einteger operator==(uint64_t) const
Encrypted equality comparison with a plaintext uint64_t.
const Einteger operator>>=(int)
Encrypted right shift assignment.
virtual const Einteger operator%(uint64_t) const
Encrypted modulo with a plaintext uint64_t.
static FixedPoint promote(const Einteger &a, size_t s)
Promotes or truncates an Einteger to a specific bit size.
friend const Einteger operator*(uint64_t a, const Einteger &b)
Friend operator for plaintext uint64_t multiplication with Einteger.
friend ostream & operator<<(ostream &out, const Einteger &obj)
Overloads the stream insertion operator by decrypting Einteger.
friend const Einteger operator<(uint64_t a, const Einteger &b)
Friend operator for plaintext uint64_t less-than comparison with Einteger.
const FixedPoint & getData() const
Gets the underlying FixedPoint data.
virtual const Einteger operator~() const
Encrypted bitwise NOT (one's complement).
virtual const Einteger operator^(uint64_t) const
Encrypted bitwise XOR with a plaintext uint64_t.
virtual const Einteger operator&(uint64_t) const
Encrypted bitwise AND with a plaintext uint64_t.
virtual const Einteger operator>=(uint64_t) const
Encrypted greater-than-or-equal comparison with a plaintext uint64_t.
Einteger(int64_t d)
Constructs an Einteger from a plaintext int64_t.
virtual const Einteger operator<(uint64_t) const
Encrypted less-than comparison with a plaintext uint64_t.
Einteger(size_t n_digits, bool is_signed)
Constructs an Einteger with a specified number of bits and signedness.
virtual const Einteger operator<=(uint64_t) const
Encrypted less-than-or-equal comparison with a plaintext uint64_t.
Einteger(uint64_t d, size_t n_digits)
Constructs an Einteger from a plaintext uint64_t with a specified number of bits.
friend const Einteger operator-(uint64_t a, const Einteger &b)
Friend operator for plaintext uint64_t subtraction with Einteger.
friend const Einteger operator||(uint64_t a, const Einteger &b)
Friend operator for plaintext uint64_t logical OR with Einteger.
const Einteger operator-() const
Encrypted unary negation (two's complement).
friend const Einteger operator^(uint64_t a, const Einteger &b)
Friend operator for plaintext uint64_t bitwise XOR with Einteger.
const Einteger operator<<(int) const
Encrypted left shift.
virtual const Einteger operator%(const Einteger &) const
Encrypted modulo with another Einteger.
virtual const Einteger operator&(const Einteger &) const
Encrypted bitwise AND with another Einteger.
virtual const Einteger operator-=(uint64_t)
Encrypted subtraction assignment with a plaintext uint64_t.
virtual const Einteger operator&&(uint64_t) const
Encrypted logical AND with a plaintext uint64_t.
virtual const Einteger operator*(uint64_t) const
Encrypted multiplication with a plaintext uint64_t.
friend const Einteger operator!=(uint64_t a, const Einteger &b)
Friend operator for plaintext uint64_t inequality comparison with Einteger.
virtual const Einteger operator&&(const Einteger &) const
Encrypted logical AND with another Einteger.
friend const Einteger operator%(uint64_t a, const Einteger &b)
Friend operator for plaintext uint64_t modulo with Einteger.
A bit-vector representation of an encrypted or plaintext word.
Definition FixedPoint.h:118