lmi-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lmi-commits] [lmi] master bc74cf2a 3/4: Prepare to implement TAOCP 4.6.


From: Greg Chicares
Subject: [lmi-commits] [lmi] master bc74cf2a 3/4: Prepare to implement TAOCP 4.6.3
Date: Sun, 29 May 2022 20:51:23 -0400 (EDT)

branch: master
commit bc74cf2a7f5029f1a2f2df597a54bed67ceab71d
Author: Gregory W. Chicares <gchicares@sbcglobal.net>
Commit: Gregory W. Chicares <gchicares@sbcglobal.net>

    Prepare to implement TAOCP 4.6.3
---
 Makefile.am      |  9 +++++++++
 bin_exp.cpp      | 24 ++++++++++++++++++++++++
 bin_exp.hpp      | 27 +++++++++++++++++++++++++++
 bin_exp_test.cpp | 31 +++++++++++++++++++++++++++++++
 objects.make     |  7 +++++++
 5 files changed, 98 insertions(+)

diff --git a/Makefile.am b/Makefile.am
index 83751ab4..0e74f16b 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -102,6 +102,7 @@ TESTS = \
     any_member_test \
     assert_lmi_test \
     authenticity_test \
+    bin_exp_test \
     bourn_cast_test \
     cache_file_reads_test \
     calendar_date_test \
@@ -635,6 +636,13 @@ authenticity_test_CXXFLAGS = $(AM_CXXFLAGS)
 authenticity_test_LDADD = \
   libtest_common.la
 
+bin_exp_test_SOURCES = \
+  bin_exp.cpp \
+  bin_exp_test.cpp
+bin_exp_test_CXXFLAGS = $(AM_CXXFLAGS)
+bin_exp_test_LDADD = \
+  libtest_common.la
+
 bourn_cast_test_LDADD = \
   libtest_common.la
 
@@ -1139,6 +1147,7 @@ noinst_HEADERS = \
     authenticity.hpp \
     basic_tables.hpp \
     basic_values.hpp \
+    bin_exp.hpp \
     bourn_cast.hpp \
     cache_file_reads.hpp \
     calendar_date.hpp \
diff --git a/bin_exp.cpp b/bin_exp.cpp
new file mode 100644
index 00000000..c590615e
--- /dev/null
+++ b/bin_exp.cpp
@@ -0,0 +1,24 @@
+// TAOCP 4.6.3 Right-to-left binary method for exponentiation.
+//
+// Copyright (C) 2022 Gregory W. Chicares.
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License version 2 as
+// published by the Free Software Foundation.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software Foundation,
+// Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+//
+// https://savannah.nongnu.org/projects/lmi
+// email: <gchicares@sbcglobal.net>
+// snail: Chicares, 186 Belle Woods Drive, Glastonbury CT 06033, USA
+
+#include "pchfile.hpp"
+
+#include "bin_exp.hpp"
diff --git a/bin_exp.hpp b/bin_exp.hpp
new file mode 100644
index 00000000..445c1a9c
--- /dev/null
+++ b/bin_exp.hpp
@@ -0,0 +1,27 @@
+// TAOCP 4.6.3 Right-to-left binary method for exponentiation.
+//
+// Copyright (C) 2022 Gregory W. Chicares.
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License version 2 as
+// published by the Free Software Foundation.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software Foundation,
+// Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+//
+// https://savannah.nongnu.org/projects/lmi
+// email: <gchicares@sbcglobal.net>
+// snail: Chicares, 186 Belle Woods Drive, Glastonbury CT 06033, USA
+
+#ifndef bin_exp_hpp
+#define bin_exp_hpp
+
+#include "config.hpp"
+
+#endif // bin_exp_hpp
diff --git a/bin_exp_test.cpp b/bin_exp_test.cpp
new file mode 100644
index 00000000..a61ecde3
--- /dev/null
+++ b/bin_exp_test.cpp
@@ -0,0 +1,31 @@
+// TAOCP 4.6.3 Right-to-left binary method for exponentiation--unit test.
+//
+// Copyright (C) 2022 Gregory W. Chicares.
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License version 2 as
+// published by the Free Software Foundation.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software Foundation,
+// Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+//
+// https://savannah.nongnu.org/projects/lmi
+// email: <gchicares@sbcglobal.net>
+// snail: Chicares, 186 Belle Woods Drive, Glastonbury CT 06033, USA
+
+#include "pchfile.hpp"
+
+#include "bin_exp.hpp"
+
+#include "test_tools.hpp"
+
+int test_main(int, char*[])
+{
+    return 0;
+}
diff --git a/objects.make b/objects.make
index 22745726..f5a5a211 100644
--- a/objects.make
+++ b/objects.make
@@ -367,6 +367,7 @@ unit_test_targets := \
   any_member_test \
   assert_lmi_test \
   authenticity_test \
+  bin_exp_test \
   bourn_cast_test \
   cache_file_reads_test \
   calendar_date_test \
@@ -507,6 +508,12 @@ authenticity_test$(EXEEXT): \
   system_command_non_wx.o \
   timer.o \
 
+bin_exp_test$(EXEEXT): \
+  $(common_test_objects) \
+  bin_exp.o \
+  bin_exp_test.o \
+  timer.o \
+
 bourn_cast_test$(EXEEXT): \
   $(common_test_objects) \
   bourn_cast_test.o \



reply via email to

[Prev in Thread] Current Thread [Next in Thread]