Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
xerus
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
40
Issues
40
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
xerus
xerus
Commits
70aa8d02
Commit
70aa8d02
authored
Dec 11, 2017
by
Ben Huber
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed ambiguous calls to misc::pow on some systems (relates
#205
)
parent
aa5cad36
Pipeline
#854
passed with stages
in 8 minutes and 36 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
24 deletions
+4
-24
include/xerus/misc/math.h
include/xerus/misc/math.h
+4
-24
No files found.
include/xerus/misc/math.h
View file @
70aa8d02
...
...
@@ -46,35 +46,15 @@ namespace xerus {
///@brief: Calculates _base^_exp by binary exponentiation
template
<
class
T
>
constexpr
T
pow
(
const
T
&
_base
,
const
uint32
_exp
)
noexcept
{
return
_exp
==
0
?
T
(
1
)
:
(
_exp
%
2
==
0
?
pow
(
T
(
_base
*
_base
),
_exp
/
2
)
:
T
(
_base
*
pow
(
_base
,
_exp
-
1
)));
}
///@brief: Calculates _base^_exp by binary exponentiation
template
<
class
T
>
constexpr
T
pow
(
const
T
&
_base
,
const
uint64
_exp
)
noexcept
{
template
<
class
T
,
class
I
,
typename
std
::
enable_if
<
std
::
is_integral
<
I
>
::
value
&&
std
::
is_unsigned
<
I
>::
value
,
bool
>::
type
=
true
>
constexpr
T
pow
(
const
T
&
_base
,
const
I
_exp
)
noexcept
{
return
_exp
==
0
?
T
(
1
)
:
(
_exp
%
2
==
0
?
pow
(
T
(
_base
*
_base
),
_exp
/
2
)
:
T
(
_base
*
pow
(
_base
,
_exp
-
1
)));
}
///@brief: Calculates _base^_exp by binary exponentiation
template
<
class
T
>
constexpr
T
pow
(
const
T
&
_base
,
const
int64
_exp
)
noexcept
{
return
_exp
==
0
?
T
(
1
)
:
(
_exp
<
0
?
T
(
1
/
pow
(
_base
,
-
_exp
))
:
(
_exp
%
2
==
0
?
pow
(
T
(
_base
*
_base
),
_exp
/
2
)
:
T
(
_base
*
pow
(
_base
,
_exp
-
1
))
)
);
}
///@brief: Calculates _base^_exp by binary exponentiation
template
<
class
T
>
constexpr
T
pow
(
const
T
&
_base
,
const
int32
_exp
)
noexcept
{
template
<
class
T
,
class
I
,
typename
std
::
enable_if
<
std
::
is_integral
<
I
>
::
value
&&
!
std
::
is_unsigned
<
I
>::
value
,
bool
>::
type
=
true
>
constexpr
T
pow
(
const
T
&
_base
,
const
I
_exp
)
noexcept
{
return
_exp
==
0
?
T
(
1
)
:
(
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment