]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#2658] add support for big ints
authorAndrei Pavel <andrei@isc.org>
Wed, 26 Apr 2023 12:02:55 +0000 (15:02 +0300)
committerAndrei Pavel <andrei@isc.org>
Wed, 17 May 2023 16:09:38 +0000 (19:09 +0300)
src/lib/util/Makefile.am
src/lib/util/bigints.h [new file with mode: 0644]

index 3c7342ac5187d383f0776e3e494354229cd30664..9c0d46f79e8d0a15c17fa781784884cd4630d5d0 100644 (file)
@@ -7,7 +7,9 @@ AM_CPPFLAGS += $(BOOST_INCLUDES)
 AM_CXXFLAGS = $(KEA_CXXFLAGS)
 
 lib_LTLIBRARIES = libkea-util.la
-libkea_util_la_SOURCES  = boost_time_utils.h boost_time_utils.cc
+libkea_util_la_SOURCES  =
+libkea_util_la_SOURCES += bigints.h
+libkea_util_la_SOURCES += boost_time_utils.h boost_time_utils.cc
 libkea_util_la_SOURCES += buffer.h io_utilities.h
 libkea_util_la_SOURCES += chrono_time_utils.h chrono_time_utils.cc
 libkea_util_la_SOURCES += csv_file.h csv_file.cc
@@ -57,6 +59,7 @@ CLEANFILES = *.gcno *.gcda
 # Specify the headers for copying into the installation directory tree.
 libkea_util_includedir = $(pkgincludedir)/util
 libkea_util_include_HEADERS = \
+       bigints.h \
        boost_time_utils.h \
        buffer.h \
        csv_file.h \
diff --git a/src/lib/util/bigints.h b/src/lib/util/bigints.h
new file mode 100644 (file)
index 0000000..be76b1d
--- /dev/null
@@ -0,0 +1,26 @@
+// Copyright (C) 2023 Internet Systems Consortium, Inc. ("ISC")
+//
+// This Source Code Form is subject to the terms of the Mozilla Public
+// License, v. 2.0. If a copy of the MPL was not distributed with this
+// file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+// This file provides an interface towards bigint implementations.
+// Currently, it uses the ones from boost::multiprecision, but if we ever want
+// to swap it out, or implement our own, we can seamlessly do it in this header.
+
+#ifndef UTIL_BIGINTS_H
+#define UTIL_BIGINTS_H
+
+#include <boost/multiprecision/cpp_int.hpp>
+
+namespace isc {
+namespace util {
+
+using int128_t = boost::multiprecision::int128_t;
+
+using uint128_t = boost::multiprecision::uint128_t;
+
+}  // namespace util
+}  // namespace isc
+
+#endif  // UTIL_BIGINTS_H
\ No newline at end of file