Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
tnl-dev
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor 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
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
TNL
tnl-dev
Commits
3a0d6bdc
There was an error fetching the commit references. Please try again later.
Commit
3a0d6bdc
authored
8 years ago
by
Jakub Klinkovský
Browse files
Options
Downloads
Patches
Plain Diff
Functions in Constants.h can be constexpr functions
parent
664c84c0
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/TNL/Constants.h
+25
-26
25 additions, 26 deletions
src/TNL/Constants.h
with
25 additions
and
26 deletions
src/TNL/Constants.h
+
25
−
26
View file @
3a0d6bdc
...
...
@@ -12,37 +12,36 @@
#include
<limits.h>
#include
<float.h>
#include
<cstdio>
#include
<TNL/Assert.h>
#include
<TNL/Devices/Cuda.h>
namespace
TNL
{
template
<
typename
T
>
__cuda_callable__
T
tnlMinValue
(){
Assert
(
false
,
)
};
template
<
>
inline
__cuda_callable__
char
tnlMinValue
<
char
>
()
{
return
CHAR_MIN
;
}
template
<
>
inline
__cuda_callable__
unsigned
char
tnlMinValue
<
unsigned
char
>
()
{
return
0
;
}
template
<
>
inline
__cuda_callable__
short
int
tnlMinValue
<
short
int
>
()
{
return
SHRT_MIN
;
}
template
<
>
inline
__cuda_callable__
unsigned
short
int
tnlMinValue
<
unsigned
short
int
>
()
{
return
0
;
}
template
<
>
inline
__cuda_callable__
int
tnlMinValue
<
int
>
()
{
return
INT_MIN
;
}
template
<
>
inline
__cuda_callable__
unsigned
int
tnlMinValue
<
unsigned
int
>
()
{
return
0
;
}
template
<
>
inline
__cuda_callable__
long
int
tnlMinValue
<
long
int
>
()
{
return
LONG_MIN
;
}
template
<
>
inline
__cuda_callable__
unsigned
long
int
tnlMinValue
<
unsigned
long
int
>
()
{
return
0
;
}
template
<
>
inline
__cuda_callable__
float
tnlMinValue
<
float
>
()
{
return
-
FLT_MAX
;
}
template
<
>
inline
__cuda_callable__
double
tnlMinValue
<
double
>
()
{
return
-
DBL_MAX
;
}
template
<
>
inline
__cuda_callable__
long
double
tnlMinValue
<
long
double
>
()
{
return
-
LDBL_MAX
;
}
template
<
typename
T
>
__cuda_callable__
T
tnlMaxValue
(){
Assert
(
false
,
)
};
template
<
>
inline
__cuda_callable__
char
tnlMaxValue
<
char
>
()
{
return
CHAR_MAX
;
}
template
<
>
inline
__cuda_callable__
unsigned
char
tnlMaxValue
<
unsigned
char
>
()
{
return
UCHAR_MAX
;
}
template
<
>
inline
__cuda_callable__
short
int
tnlMaxValue
<
short
int
>
()
{
return
SHRT_MAX
;
}
template
<
>
inline
__cuda_callable__
unsigned
short
int
tnlMaxValue
<
unsigned
short
int
>
()
{
return
USHRT_MAX
;
}
template
<
>
inline
__cuda_callable__
int
tnlMaxValue
<
int
>
()
{
return
INT_MAX
;
}
template
<
>
inline
__cuda_callable__
unsigned
int
tnlMaxValue
<
unsigned
int
>
()
{
return
UINT_MAX
;
}
template
<
>
inline
__cuda_callable__
long
int
tnlMaxValue
<
long
int
>
()
{
return
LONG_MAX
;
}
template
<
>
inline
__cuda_callable__
unsigned
long
int
tnlMaxValue
<
unsigned
long
int
>
()
{
return
ULONG_MAX
;
}
template
<
>
inline
__cuda_callable__
float
tnlMaxValue
<
float
>
()
{
return
FLT_MAX
;
}
template
<
>
inline
__cuda_callable__
double
tnlMaxValue
<
double
>
()
{
return
DBL_MAX
;
}
template
<
>
inline
__cuda_callable__
long
double
tnlMaxValue
<
long
double
>
()
{
return
LDBL_MAX
;
}
template
<
typename
T
>
T
tnlMinValue
()
{
Assert
(
false
,
);
};
template
<
>
constexpr
char
tnlMinValue
<
char
>
()
{
return
CHAR_MIN
;
}
template
<
>
constexpr
unsigned
char
tnlMinValue
<
unsigned
char
>
()
{
return
0
;
}
template
<
>
constexpr
short
int
tnlMinValue
<
short
int
>
()
{
return
SHRT_MIN
;
}
template
<
>
constexpr
unsigned
short
int
tnlMinValue
<
unsigned
short
int
>
()
{
return
0
;
}
template
<
>
constexpr
int
tnlMinValue
<
int
>
()
{
return
INT_MIN
;
}
template
<
>
constexpr
unsigned
int
tnlMinValue
<
unsigned
int
>
()
{
return
0
;
}
template
<
>
constexpr
long
int
tnlMinValue
<
long
int
>
()
{
return
LONG_MIN
;
}
template
<
>
constexpr
unsigned
long
int
tnlMinValue
<
unsigned
long
int
>
()
{
return
0
;
}
template
<
>
constexpr
float
tnlMinValue
<
float
>
()
{
return
-
FLT_MAX
;
}
template
<
>
constexpr
double
tnlMinValue
<
double
>
()
{
return
-
DBL_MAX
;
}
template
<
>
constexpr
long
double
tnlMinValue
<
long
double
>
()
{
return
-
LDBL_MAX
;
}
template
<
typename
T
>
T
tnlMaxValue
()
{
Assert
(
false
,
);
};
template
<
>
constexpr
char
tnlMaxValue
<
char
>
()
{
return
CHAR_MAX
;
}
template
<
>
constexpr
unsigned
char
tnlMaxValue
<
unsigned
char
>
()
{
return
UCHAR_MAX
;
}
template
<
>
constexpr
short
int
tnlMaxValue
<
short
int
>
()
{
return
SHRT_MAX
;
}
template
<
>
constexpr
unsigned
short
int
tnlMaxValue
<
unsigned
short
int
>
()
{
return
USHRT_MAX
;
}
template
<
>
constexpr
int
tnlMaxValue
<
int
>
()
{
return
INT_MAX
;
}
template
<
>
constexpr
unsigned
int
tnlMaxValue
<
unsigned
int
>
()
{
return
UINT_MAX
;
}
template
<
>
constexpr
long
int
tnlMaxValue
<
long
int
>
()
{
return
LONG_MAX
;
}
template
<
>
constexpr
unsigned
long
int
tnlMaxValue
<
unsigned
long
int
>
()
{
return
ULONG_MAX
;
}
template
<
>
constexpr
float
tnlMaxValue
<
float
>
()
{
return
FLT_MAX
;
}
template
<
>
constexpr
double
tnlMaxValue
<
double
>
()
{
return
DBL_MAX
;
}
template
<
>
constexpr
long
double
tnlMaxValue
<
long
double
>
()
{
return
LDBL_MAX
;
}
}
// namespace TNL
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