summaryrefslogtreecommitdiff
path: root/fxdiv.spec
diff options
context:
space:
mode:
Diffstat (limited to 'fxdiv.spec')
-rw-r--r--fxdiv.spec82
1 files changed, 82 insertions, 0 deletions
diff --git a/fxdiv.spec b/fxdiv.spec
new file mode 100644
index 0000000..9fd2a40
--- /dev/null
+++ b/fxdiv.spec
@@ -0,0 +1,82 @@
+%global commit0 63058eff77e11aa15bf531df5dd34395ec3017c8
+%global shortcommit0 %(c=%{commit0}; echo ${c:0:7})
+%global date0 20201208
+%global upstream_name FXdiv
+
+Summary: Header for division via fixed-point math
+Name: fxdiv
+License: MIT
+Version: 1.0^git%{date0}.%{shortcommit0}
+Release: 5%{?dist}
+
+# Only a header
+BuildArch: noarch
+
+URL: https://github.com/Maratyszcza/%{name}
+Source0: %{url}/archive/%{commit0}/%{upstream_name}-%{shortcommit0}.tar.gz
+
+BuildRequires: cmake
+BuildRequires: gcc-c++
+BuildRequires: gtest-devel
+
+%description
+Header-only library for division via fixed-point multiplication by inverse
+
+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.
+
+Features
+ * Integer division for uint32_t, uint64_t, and size_t
+ * Header-only library, no installation or build required
+ * Compatible with C99, C++, OpenCL, and CUDA
+ * Uses platform-specific compiler intrinsics for optimal performance
+ * Covered with unit tests and microbenchmarks
+
+%package devel
+
+Summary: Header for division via fixed-point math
+Provides: %{name}-static = %{version}-%{release}
+
+%description devel
+Header-only library for division via fixed-point multiplication by inverse
+
+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.
+
+Features
+ * Integer division for uint32_t, uint64_t, and size_t
+ * Header-only library, no installation or build required
+ * Compatible with C99, C++, OpenCL, and CUDA
+ * Uses platform-specific compiler intrinsics for optimal performance
+ * Covered with unit tests and microbenchmarks
+
+%prep
+%autosetup -p1 -n %{upstream_name}-%{commit0}
+
+%build
+
+%cmake \
+ -DFXDIV_USE_SYSTEM_LIBS=ON \
+ -DFXDIV_BUILD_TESTS=ON \
+ -DFXDIV_BUILD_BENCHMARKS=OFF \
+
+%cmake_build
+%check
+%ctest
+%install
+%cmake_install
+%files devel
+%license LICENSE
+%doc README.md
+%{_includedir}/fxdiv.h
+
+%changelog
+
+* Tue Nov 05 2024 Zheng Zhenyu <zhengzhenyu@openeuler.sh> - 1.0^git20201208.63058ef-1
+- Initial package