summary refs log tree commit diff
path: root/gnu/packages/maths.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludovic.courtes@inria.fr>2021-07-29 15:42:10 +0200
committerLudovic Courtès <ludo@gnu.org>2021-07-29 21:54:54 +0200
commita9bc8a25eb9a5851062167a3475622ba6b1a8b9a (patch)
treef579f30adf7eac4259d310276ab936dfa5d2338e /gnu/packages/maths.scm
parentffb381856d0c6cc1a557b789f6b377cfa17002a0 (diff)
downloadguix-a9bc8a25eb9a5851062167a3475622ba6b1a8b9a.tar.gz
gnu: Add FXDiv.
* gnu/packages/maths.scm (fxdiv): New variable.
* gnu/packages/patches/fxdiv-system-libraries.patch: New file.
* gnu/local.mk (dist_patch_DATA): Add it.
Diffstat (limited to 'gnu/packages/maths.scm')
-rw-r--r--gnu/packages/maths.scm31
1 files changed, 31 insertions, 0 deletions
diff --git a/gnu/packages/maths.scm b/gnu/packages/maths.scm
index d4e3aca21e..e170fd4db9 100644
--- a/gnu/packages/maths.scm
+++ b/gnu/packages/maths.scm
@@ -127,6 +127,7 @@
   #:use-module (gnu packages netpbm)
   #:use-module (gnu packages ocaml)
   #:use-module (gnu packages onc-rpc)
+  #:use-module (gnu packages parallel)
   #:use-module (gnu packages pcre)
   #:use-module (gnu packages popt)
   #:use-module (gnu packages perl)
@@ -6657,3 +6658,33 @@ high-performance multidimensional array containers for scientific computing.")
     (license (list license:artistic2.0
                    license:bsd-3
                    license:lgpl3+))))
+
+(define-public fxdiv
+  ;; There is currently no tag in this repo.
+  (let ((commit "63058eff77e11aa15bf531df5dd34395ec3017c8")
+        (version "0.0")
+        (revision "1"))
+    (package
+      (name "fxdiv")
+      (version (git-version version revision commit))
+      (home-page "https://github.com/Maratyszcza/FXdiv")
+      (source (origin
+                (method git-fetch)
+                (uri (git-reference (url home-page) (commit commit)))
+                (file-name (git-file-name name version))
+                (sha256
+                 (base32
+                  "0zwzh8gmbx4m6b18s5nf13b0dk5yjkd1fs8f421bl7fz5f9gjd9f"))
+                (patches (search-patches "fxdiv-system-libraries.patch"))))
+      (build-system cmake-build-system)
+      (inputs
+       `(("googletest" ,googletest)
+         ("googlebenchmark" ,googlebenchmark)))
+      (synopsis
+       "C++ library for division via fixed-point multiplication by inverse")
+      (description
+       "On modern CPUs and GPUs, integer division is several times slower than
+multiplication.  FXdiv implements an algorithm to replace an integer division
+with a multiplication and two shifts.  This algorithm improves performance
+when an application performs repeated divisions by the same divisor.")
+      (license license:expat))))