blob: 18d4474b5c898c9c7946327bd81713e4eca40047 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
|
%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
%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
|