Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

871 remove includes and some obsolete code #898

Merged
merged 8 commits into from
Nov 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/core/include/lattice/hal/default/poly-impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@
#include "utils/inttypes.h"

#include <cmath>
#include <iostream>
#include <limits>
#include <memory>
#include <ostream>
#include <string>
#include <utility>
#include <vector>
Expand Down
2 changes: 1 addition & 1 deletion src/core/include/lattice/hal/elemparams.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
#include "utils/inttypes.h"
#include "utils/serializable.h"

#include <iostream>
#include <ostream>
#include <string>
#include <utility>

Expand Down
2 changes: 1 addition & 1 deletion src/core/include/math/hal/bigintdyn/mubintvecdyn.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
#include "utils/serializable.h"

#include <initializer_list>
#include <iostream>
#include <ostream>
#include <string>
#include <utility>
#include <vector>
Expand Down
21 changes: 2 additions & 19 deletions src/core/include/math/hal/bigintdyn/ubintdyn.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,11 @@
#include "utils/serializable.h"
#include "utils/utilities.h"

// #include <fstream>
#include <functional>
#include <iostream>
#include <limits>
// #include <memory>
#include <ostream>
#include <string>
#include <type_traits>
// #include <typeinfo>
#include <utility>
#include <vector>

Expand Down Expand Up @@ -882,21 +879,7 @@ class ubint final : public lbcrypto::BigIntegerInterface<ubint<limb_t>> {
/**
* documentation function, prints sizes of constats.
*/
static void PrintIntegerConstants() {
std::cout << "sizeof UINT8_C " << sizeof(UINT8_C(1)) << std::endl;
std::cout << "sizeof UINT16_C " << sizeof(UINT16_C(1)) << std::endl;
std::cout << "sizeof UINT32_C " << sizeof(UINT32_C(1)) << std::endl;
std::cout << "sizeof UINT64_C " << sizeof(UINT64_C(1)) << std::endl;
std::cout << "sizeof uint8_t " << sizeof(uint8_t) << std::endl;
std::cout << "sizeof uint16_t " << sizeof(uint16_t) << std::endl;
std::cout << "sizeof uint32_t " << sizeof(uint32_t) << std::endl;
std::cout << "sizeof uint64_t " << sizeof(uint64_t) << std::endl;
#if defined(HAVE_INT128)
// std::cout << "sizeof UINT128_C "<< sizeof (UINT128_C(1)) << std::endl;
// dbc commented out unsupported on some machines
std::cout << "sizeof uint128_t " << sizeof(uint128_t) << std::endl;
#endif
}
static void PrintIntegerConstants();

template <class Archive>
void save(Archive& ar, std::uint32_t const version) const {
Expand Down
6 changes: 3 additions & 3 deletions src/core/include/math/hal/bigintfxd/mubintvecfxd.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,13 @@
#ifndef LBCRYPTO_MATH_HAL_BIGINTFXD_MUBINVECFXD_H
#define LBCRYPTO_MATH_HAL_BIGINTFXD_MUBINVECFXD_H

#include <iostream>
#include <string>
#include "math/hal/bigintfxd/ubintfxd.h"

#include "utils/inttypes.h"
#include "utils/serializable.h"

#include "math/hal/bigintfxd/ubintfxd.h"
#include <ostream>
#include <string>

/**
* @namespace bigintfxd
Expand Down
23 changes: 11 additions & 12 deletions src/core/include/math/hal/bigintfxd/ubintfxd.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,18 +44,6 @@
#ifndef LBCRYPTO_MATH_HAL_BIGINTFXD_UBINTFXD_H
#define LBCRYPTO_MATH_HAL_BIGINTFXD_UBINTFXD_H

#include <cstdlib>
#include <cstring>
#include <fstream>
#include <functional>
#include <iostream>
#include <limits>
#include <memory>
#include <string>
#include <type_traits>
#include <typeinfo>
#include <vector>

#include "math/hal/basicint.h"
#include "math/hal/integer.h"

Expand All @@ -66,6 +54,17 @@
#include "utils/serializable.h"
#include "utils/utilities.h"

#include <cstdlib>
#include <cstring>
#include <fstream>
#include <functional>
#include <limits>
#include <memory>
#include <ostream>
#include <string>
#include <type_traits>
#include <typeinfo>

////////// bigintfxd code
typedef uint32_t integral_dtype;

Expand Down
10 changes: 5 additions & 5 deletions src/core/include/math/hal/bigintntl/mubintvecntl.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,16 +47,16 @@
#include <NTL/vec_ZZ.h>
#include <NTL/vector.h>

#include <initializer_list>
#include <iostream>
#include <string>
#include <vector>

#include "math/hal/bigintntl/ubintntl.h"
#include "utils/exception.h"
#include "utils/inttypes.h"
#include "utils/serializable.h"

#include <initializer_list>
#include <ostream>
#include <string>
#include <vector>

// defining this forces modulo when you write to the vector (except with at())
// this is becuase NTL required inputs to modmath to be < modulus but BU does
// not play with this and you will see different tests in pke pass and fail.
Expand Down
2 changes: 1 addition & 1 deletion src/core/include/math/hal/bigintntl/ubintntl.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@
#include <exception>
#include <fstream>
#include <functional>
#include <iostream>
#include <limits>
#include <memory>
#include <ostream>
#include <sstream>
#include <string>
#include <type_traits>
Expand Down
2 changes: 1 addition & 1 deletion src/core/include/math/hal/intnat/mubintvecnat.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@

#include <algorithm>
#include <initializer_list>
#include <iostream>
#include <ostream>
#include <string>
#include <utility>
#include <vector>
Expand Down
7 changes: 1 addition & 6 deletions src/core/include/math/hal/intnat/ubintnat.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,16 +48,11 @@
#include "utils/serializable.h"

#include <cstdint>
// #include <cstdlib>
// #include <fstream>
#include <functional>
#include <iostream>
#include <limits>
// #include <memory>
// #include <sstream>
#include <ostream>
#include <string>
#include <type_traits>
// #include <typeinfo>
#include <vector>
#include <utility>

Expand Down
2 changes: 1 addition & 1 deletion src/core/include/math/matrix.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@

#include <cmath>
#include <functional>
// #include <iostream>
#include <memory>
#include <ostream>
#include <string>
#include <utility>
#include <vector>
Expand Down
3 changes: 1 addition & 2 deletions src/core/include/math/matrixstrassen.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,9 @@
#include "utils/exception.h"
#include "utils/parallel.h"

// #include <cmath>
#include <functional>
// #include <iostream>
#include <memory>
#include <ostream>
#include <utility>
#include <vector>

Expand Down
3 changes: 0 additions & 3 deletions src/core/include/utils/debug.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,6 @@
#ifndef __dbg_h__
#define __dbg_h__

// include <iostream>
// include <cstdlib.h>

/* defining NDEBUG in the compile line turns everything off.
unless PROFILE is defined in the file before all includes,'
in which case TIC/TOC will still work and PROFILELOG() can be
Expand Down
5 changes: 2 additions & 3 deletions src/core/include/utils/exception.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@

#include "utils/get-call-stack.h"
#include <exception>
#include <iostream>
#include <mutex>
#include <stdexcept>
#include <string>
Expand Down Expand Up @@ -185,12 +184,12 @@ class OpenFHEException : public std::exception {
return m_errorMessage.c_str();
}

std::vector<std::string> getCallStackAsVector() {
std::vector<std::string> getCallStackAsVector() const {
return m_callStack;
}

// getCallStackAsString() was added to be used by JSON logger. the implementtion will follow
std::string getCallStackAsString() {
std::string getCallStackAsString() const {
return std::string();
}
};
Expand Down
1 change: 0 additions & 1 deletion src/core/include/utils/hashutil.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
#define _SRC_LIB_UTILS_HASHUTIL_H

#include <utils/exception.h>
#include <iostream>
#include <string>
#include <vector>

Expand Down
29 changes: 2 additions & 27 deletions src/core/include/utils/memory.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,38 +36,13 @@
#ifndef LBCRYPTO_UTILS_MEMORY_H
#define LBCRYPTO_UTILS_MEMORY_H

#include <algorithm>
#include <iterator>
#include <memory>
#include <cstdint>
#include <cstddef>
#include <utility>
#include <vector>
#include <cstddef>

namespace lbcrypto {

// make_unique was left out of c++11, these are the accepted implementation
#if _MSC_VER == 1700

// MSVC11 does not support variadic templates
#define _MAKE_UNIQUE(TEMPLATE_LIST, PADDING_LIST, LIST, COMMA, X1, X2, X3, X4) \
\
template <class T COMMA LIST(_CLASS_TYPE)> \
inline std::unique_ptr<T> make_unique(LIST(_TYPE_REFREF_ARG)) { \
return std::unique_ptr<T>(new T(LIST(_FORWARD_ARG))); \
}
_VARIADIC_EXPAND_0X(_MAKE_UNIQUE, , , , )
#undef _MAKE_UNIQUE

#else

// *nix implementation
template <typename T, typename... Args>
std::unique_ptr<T> make_unique(Args&&... args) {
return std::unique_ptr<T>(new T(std::forward<Args>(args)...));
}

#endif

template <class X>
void MoveAppend(std::vector<X>& dst, std::vector<X>& src) {
if (dst.empty()) {
Expand Down
3 changes: 2 additions & 1 deletion src/core/include/utils/serial.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@

#include "utils/sertype.h"

#include <iostream>

#ifndef CEREAL_RAPIDJSON_HAS_STDSTRING
#define CEREAL_RAPIDJSON_HAS_STDSTRING 1
#endif
Expand Down Expand Up @@ -82,7 +84,6 @@
#endif

#include <fstream>
#include <iostream>
#include <sstream>
#include <string>

Expand Down
2 changes: 1 addition & 1 deletion src/core/include/utils/serializable.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
#pragma clang diagnostic pop
#endif

#include <iostream>
#include <ostream>
#include <string>
#include <vector>

Expand Down
1 change: 0 additions & 1 deletion src/core/include/utils/type_name.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@

#include "utils/demangle.h"
#include <typeinfo>
#include <iostream>
#include <memory>
#include <string>

Expand Down
17 changes: 17 additions & 0 deletions src/core/lib/math/hal/bigintdyn/ubintdyn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1008,6 +1008,23 @@ uschar ubint<limb_t>::GetBitAtIndex(usint index) const {

template class bigintdyn::ubint<expdtype>;

template <typename limb_t>
void ubint<limb_t>::PrintIntegerConstants() {
std::cout << "sizeof UINT8_C " << sizeof(UINT8_C(1)) << std::endl;
std::cout << "sizeof UINT16_C " << sizeof(UINT16_C(1)) << std::endl;
std::cout << "sizeof UINT32_C " << sizeof(UINT32_C(1)) << std::endl;
std::cout << "sizeof UINT64_C " << sizeof(UINT64_C(1)) << std::endl;
std::cout << "sizeof uint8_t " << sizeof(uint8_t) << std::endl;
std::cout << "sizeof uint16_t " << sizeof(uint16_t) << std::endl;
std::cout << "sizeof uint32_t " << sizeof(uint32_t) << std::endl;
std::cout << "sizeof uint64_t " << sizeof(uint64_t) << std::endl;
#if defined(HAVE_INT128)
// std::cout << "sizeof UINT128_C "<< sizeof (UINT128_C(1)) << std::endl;
// dbc commented out unsupported on some machines
std::cout << "sizeof uint128_t " << sizeof(uint128_t) << std::endl;
#endif
}

#if 0
// to stream internal representation
template std::ostream& operator<<<expdtype>(std::ostream& os, const std::vector<expdtype>& v);
Expand Down
3 changes: 1 addition & 2 deletions src/pke/include/constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@
#ifndef _CONSTANTS_H_
#define _CONSTANTS_H_

#include "constants-defs.h" // all enum definitions
#include "lattice/constants-lattice.h" // additional definitions
#include "constants-defs.h" // all enum definitions

#include <iosfwd>
#include <string>
Expand Down
6 changes: 3 additions & 3 deletions src/pke/include/encoding/plaintext.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,13 @@
#include "constants.h"
#include "scheme/scheme-id.h"

#include <algorithm>
#include <initializer_list>
#include <iostream>
#include <memory>
#include <ostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <vector>

namespace lbcrypto {

Expand Down
1 change: 0 additions & 1 deletion src/pke/include/scheme/ckksrns/ckksrns-utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@

#include <vector>
#include <complex>
#include <iostream>
#include <stdint.h>
#include <memory>

Expand Down
1 change: 1 addition & 0 deletions src/pke/include/scheme/gen-cryptocontext-params.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
#include "scheme/scheme-id.h"
#include "utils/inttypes.h"
#include "constants.h"
#include "lattice/constants-lattice.h"
#include "lattice/stdlatticeparms.h"

#include <iosfwd>
Expand Down
1 change: 1 addition & 0 deletions src/pke/include/schemebase/rlwe-cryptoparameters.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
#include "lattice/lat-hal.h"
#include "schemebase/base-cryptoparameters.h"
#include "constants.h"
#include "lattice/constants-lattice.h"

// TODO - temp include for the SecurityLevel
#include "lattice/stdlatticeparms.h"
Expand Down
Loading