Rosen Penev
9ae339d39f
clang: fix various documentation errors
...
Found with -Wdocumentation
Signed-off-by: Rosen Penev <rosenp@gmail.com>
2 years ago
Rosen Penev
e854d93841
replace enable_if with if constexpr
...
Signed-off-by: Rosen Penev <rosenp@gmail.com>
2 years ago
Rosen Penev
e19ec79f98
safe_op: C++17 improvements
...
Signed-off-by: Rosen Penev <rosenp@gmail.com>
2 years ago
Rosen Penev
d458bf2540
clang-tidy: apply to newly merged stuff
...
Signed-off-by: Rosen Penev <rosenp@gmail.com>
3 years ago
Kevin Backhouse
ddd7ccf722
Use std::is_signed and std::enable_if.
3 years ago
Rosen Penev
cf963e9e4d
clang-tidy: C casts to C++
...
Signed-off-by: Rosen Penev <rosenp@gmail.com>
3 years ago
Luis Díaz Más
30bf563f4d
Update .clang-format file & apply clang-format to whole project
3 years ago
Luis Díaz Más
3f3b651c04
Remove unused stuff
3 years ago
Luis Díaz Más
b17828b454
Use SPDX for licenses ( #2122 )
...
* Use SPDX identifier in header files
* Use SPDX identifier in rest of source files
* Fix usage of SPDX for files with 2 licenses
* Add global license file
* Fix compilation
3 years ago
Rosen Penev
bd6a996181
clang-tidy: use using
...
Found with modernize-use-using
Signed-off-by: Rosen Penev <rosenp@gmail.com>
4 years ago
Robin Mills
d632988bbd
Massive code prolog cleanup.
4 years ago
Luis Díaz Más
603692a1d8
Copyright to Exiv2 authors
7 years ago
Dan Čermák
2dacb19933
[safe_op] Add Safe::abs(), calculates absoulte value without UB
...
Add a drop-in replacement for std::abs which never produces
negative values and thereby never invokes undefined behavior.
7 years ago
Dan Čermák
bf51a76e4e
[safe_op] Fix ODR violation in compiler builtin specializations
...
The compiler instrinsics are exposed via fully specialized template functions
which must not be defined twice (which they accidentally were). Declaring them
as inline fixes this issue.
7 years ago
Dan Čermák
bb2019149a
[safe_op] Don't use overflow intrinsics in MSVC 2005
7 years ago
Dan Čermák
06ec1e6984
[safe_op] Refactored addition overflow checks using functions only
...
- templated structs were not required, SFINAE works for functions too
=> use instead, removes some unneeded code
- fix non-usage of builtins with clang
- adjust unit tests
7 years ago
Dan Čermák
684c8c89de
[safe_op] Simplified unsigned int overflow check
...
Simply check for overflows after the addition, as no undefined behavior can
occur here.
7 years ago
Dan Čermák
31b96b58e7
[safe_op] improved signed int overflow checks via integer promotion
...
The fallback signed integer overflow check is quite expensive, but the addition
can be safely performed when saved in an int due to integer promotion
rules. This makes the check a little less expensive.
7 years ago
Dan Čermák
029b997ca0
[safe_op] fixed typo in doc-comment
7 years ago
Dan Čermák
7c00e9128d
Fix compilation error with gcc < 5
...
- overflow builtins were added with gcc 5.0
8 years ago
Dan Čermák
ca7c699aa1
Added overflow safe addition function
8 years ago