Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
M
marlin-anet-a8
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jonas Leder
marlin-anet-a8
Commits
f4c625d3
Commit
f4c625d3
authored
6 years ago
by
Scott Lahteine
Browse files
Options
Downloads
Patches
Plain Diff
Ensure MIN/MAX overrides
parent
30197134
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
Marlin/src/core/minmax.h
+15
-12
15 additions, 12 deletions
Marlin/src/core/minmax.h
Marlin/src/inc/MarlinConfig.h
+1
-0
1 addition, 0 deletions
Marlin/src/inc/MarlinConfig.h
frameworks/CMSIS/LPC1768/include/lpc_types.h
+0
-2
0 additions, 2 deletions
frameworks/CMSIS/LPC1768/include/lpc_types.h
with
16 additions
and
14 deletions
Marlin/src/core/minmax.h
+
15
−
12
View file @
f4c625d3
...
...
@@ -20,26 +20,29 @@
*
*/
#pragma once
#undef MIN
#undef MAX
#ifdef __cplusplus
extern
"C++"
{
#ifndef _MINMAX_H_
#define _MINMAX_H_
extern
"C++"
{
// C++11 solution that is standards compliant. Return type is deduced automatically
template
<
class
L
,
class
R
>
static
inline
constexpr
auto
MIN
(
const
L
lhs
,
const
R
rhs
)
->
decltype
(
lhs
+
rhs
)
{
return
lhs
<
rhs
?
lhs
:
rhs
;
}
template
<
class
L
,
class
R
>
static
inline
constexpr
auto
MAX
(
const
L
lhs
,
const
R
rhs
)
->
decltype
(
lhs
+
rhs
)
{
return
lhs
>
rhs
?
lhs
:
rhs
;
}
template
<
class
T
,
class
...
Ts
>
static
inline
constexpr
const
T
MIN
(
T
V
,
Ts
...
Vs
)
{
return
MIN
(
V
,
MIN
(
Vs
...));
}
template
<
class
T
,
class
...
Ts
>
static
inline
constexpr
const
T
MAX
(
T
V
,
Ts
...
Vs
)
{
return
MAX
(
V
,
MAX
(
Vs
...));
}
// C++11 solution that is standards compliant. Return type is deduced automatically
template
<
class
L
,
class
R
>
static
inline
constexpr
auto
MIN
(
const
L
lhs
,
const
R
rhs
)
->
decltype
(
lhs
+
rhs
)
{
return
lhs
<
rhs
?
lhs
:
rhs
;
}
template
<
class
L
,
class
R
>
static
inline
constexpr
auto
MAX
(
const
L
lhs
,
const
R
rhs
)
->
decltype
(
lhs
+
rhs
)
{
return
lhs
>
rhs
?
lhs
:
rhs
;
}
template
<
class
T
,
class
...
Ts
>
static
inline
constexpr
const
T
MIN
(
T
V
,
Ts
...
Vs
)
{
return
MIN
(
V
,
MIN
(
Vs
...));
}
template
<
class
T
,
class
...
Ts
>
static
inline
constexpr
const
T
MAX
(
T
V
,
Ts
...
Vs
)
{
return
MAX
(
V
,
MAX
(
Vs
...));
}
}
#endif
#else
...
...
This diff is collapsed.
Click to expand it.
Marlin/src/inc/MarlinConfig.h
+
1
−
0
View file @
f4c625d3
...
...
@@ -43,5 +43,6 @@
#include
"../core/language.h"
#include
"../core/utility.h"
#include
"../core/serial.h"
#include
"../core/minmax.h"
#endif // _MARLIN_CONFIG_H_
This diff is collapsed.
Click to expand it.
frameworks/CMSIS/LPC1768/include/lpc_types.h
+
0
−
2
View file @
f4c625d3
...
...
@@ -145,8 +145,6 @@ typedef int32_t(*PFI)();
/* External data/function define */
#define EXTERN extern
#include
"../../../../src/core/minmax.h"
/**
* @}
*/
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment