Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
glslang
Manage
Activity
Members
Plan
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Analyze
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
Show more breadcrumbs
CodeLinaro
public-release-test-restored
platform
external
deqp-deps
glslang
Commits
7cac9e72
Commit
7cac9e72
authored
8 years ago
by
baldurk
Browse files
Options
Downloads
Patches
Plain Diff
Change "using x = y;" to "typedef y x;" statements
parent
a227d272
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
SPIRV/hex_float.h
+30
-30
30 additions, 30 deletions
SPIRV/hex_float.h
with
30 additions
and
30 deletions
SPIRV/hex_float.h
+
30
−
30
View file @
7cac9e72
...
...
@@ -69,12 +69,12 @@ class Float16 {
// a value is Nan.
template
<
typename
T
>
struct
FloatProxyTraits
{
using
uint_type
=
void
;
typedef
void
uint_type
;
};
template
<
>
struct
FloatProxyTraits
<
float
>
{
using
uint_type
=
uint32_t
;
typedef
uint32_t
uint_type
;
static
bool
isNan
(
float
f
)
{
return
std
::
isnan
(
f
);
}
// Returns true if the given value is any kind of infinity.
static
bool
isInfinity
(
float
f
)
{
return
std
::
isinf
(
f
);
}
...
...
@@ -86,7 +86,7 @@ struct FloatProxyTraits<float> {
template
<
>
struct
FloatProxyTraits
<
double
>
{
using
uint_type
=
uint64_t
;
typedef
uint64_t
uint_type
;
static
bool
isNan
(
double
f
)
{
return
std
::
isnan
(
f
);
}
// Returns true if the given value is any kind of infinity.
static
bool
isInfinity
(
double
f
)
{
return
std
::
isinf
(
f
);
}
...
...
@@ -98,7 +98,7 @@ struct FloatProxyTraits<double> {
template
<
>
struct
FloatProxyTraits
<
Float16
>
{
using
uint_type
=
uint16_t
;
typedef
uint16_t
uint_type
;
static
bool
isNan
(
Float16
f
)
{
return
Float16
::
isNan
(
f
);
}
// Returns true if the given value is any kind of infinity.
static
bool
isInfinity
(
Float16
f
)
{
return
Float16
::
isInfinity
(
f
);
}
...
...
@@ -114,7 +114,7 @@ struct FloatProxyTraits<Float16> {
template
<
typename
T
>
class
FloatProxy
{
public:
using
uint_
type
=
typename
FloatProxyTraits
<
T
>::
uint_type
;
type
def
typename
FloatProxyTraits
<
T
>::
uint_type
uint_type
;
// Since this is to act similar to the normal floats,
// do not initialize the data by default.
...
...
@@ -177,13 +177,13 @@ std::istream& operator>>(std::istream& is, FloatProxy<T>& value) {
template
<
typename
T
>
struct
HexFloatTraits
{
// Integer type that can store this hex-float.
using
uint_type
=
void
;
typedef
void
uint_type
;
// Signed integer type that can store this hex-float.
using
int_type
=
void
;
typedef
void
int_type
;
// The numerical type that this HexFloat represents.
using
underlying_type
=
void
;
typedef
void
underlying_type
;
// The type needed to construct the underlying type.
using
native_type
=
void
;
typedef
void
native_type
;
// The number of bits that are actually relevant in the uint_type.
// This allows us to deal with, for example, 24-bit values in a 32-bit
// integer.
...
...
@@ -201,10 +201,10 @@ struct HexFloatTraits {
// 1 sign bit, 8 exponent bits, 23 fractional bits.
template
<
>
struct
HexFloatTraits
<
FloatProxy
<
float
>>
{
using
uint_type
=
uint32_t
;
using
int_
type
=
int32_t
;
using
underlying_
type
=
FloatProxy
<
float
>
;
using
native_type
=
float
;
typedef
uint32_t
uint_type
;
type
def
int32_t
int_type
;
type
def
FloatProxy
<
float
>
underlying_type
;
typedef
float
native_type
;
static
const
uint_type
num_used_bits
=
32
;
static
const
uint_type
num_exponent_bits
=
8
;
static
const
uint_type
num_fraction_bits
=
23
;
...
...
@@ -215,10 +215,10 @@ struct HexFloatTraits<FloatProxy<float>> {
// 1 sign bit, 11 exponent bits, 52 fractional bits.
template
<
>
struct
HexFloatTraits
<
FloatProxy
<
double
>>
{
using
uint_type
=
uint64_t
;
using
int_
type
=
int64_t
;
using
underlying_
type
=
FloatProxy
<
double
>
;
using
native_type
=
double
;
typedef
uint64_t
uint_type
;
type
def
int64_t
int_type
;
type
def
FloatProxy
<
double
>
underlying_type
;
typedef
double
native_type
;
static
const
uint_type
num_used_bits
=
64
;
static
const
uint_type
num_exponent_bits
=
11
;
static
const
uint_type
num_fraction_bits
=
52
;
...
...
@@ -229,10 +229,10 @@ struct HexFloatTraits<FloatProxy<double>> {
// 1 sign bit, 5 exponent bits, 10 fractional bits.
template
<
>
struct
HexFloatTraits
<
FloatProxy
<
Float16
>>
{
using
uint_type
=
uint16_t
;
using
int_
type
=
int16_t
;
using
underlying_type
=
uint16_t
;
using
native_type
=
uint16_t
;
typedef
uint16_t
uint_type
;
type
def
int16_t
int_type
;
typedef
uint16_t
underlying_type
;
typedef
uint16_t
native_type
;
static
const
uint_type
num_used_bits
=
16
;
static
const
uint_type
num_exponent_bits
=
5
;
static
const
uint_type
num_fraction_bits
=
10
;
...
...
@@ -252,10 +252,10 @@ enum round_direction {
template
<
typename
T
,
typename
Traits
=
HexFloatTraits
<
T
>
>
class
HexFloat
{
public:
using
uint_
type
=
typename
Traits
::
uint_type
;
using
int_
type
=
typename
Traits
::
int_type
;
using
underlying_
type
=
typename
Traits
::
underlying_type
;
using
native_
type
=
typename
Traits
::
native_type
;
type
def
typename
Traits
::
uint_type
uint_type
;
type
def
typename
Traits
::
int_type
int_type
;
type
def
typename
Traits
::
underlying_type
underlying_type
;
type
def
typename
Traits
::
native_type
native_type
;
explicit
HexFloat
(
T
f
)
:
value_
(
f
)
{}
...
...
@@ -491,7 +491,7 @@ class HexFloat {
template
<
typename
other_T
>
typename
other_T
::
uint_type
getRoundedNormalizedSignificand
(
round_direction
dir
,
bool
*
carry_bit
)
{
using
other_uint_type
=
typename
other_
T
::
uint_type
;
typedef
typename
other_
T
::
uint_type
other_uint_type
;
static
const
int_type
num_throwaway_bits
=
static_cast
<
int_type
>
(
num_fraction_bits
)
-
static_cast
<
int_type
>
(
other_T
::
num_fraction_bits
);
...
...
@@ -637,7 +637,7 @@ class HexFloat {
bool
round_underflow_up
=
isNegative
()
?
round_dir
==
kRoundToNegativeInfinity
:
round_dir
==
kRoundToPositiveInfinity
;
using
other_int_
type
=
typename
other_T
::
int_type
;
type
def
typename
other_T
::
int_type
other_int_type
;
// setFromSignUnbiasedExponentAndNormalizedSignificand will
// zero out any underflowing value (but retain the sign).
other
.
setFromSignUnbiasedExponentAndNormalizedSignificand
(
...
...
@@ -676,9 +676,9 @@ inline uint8_t get_nibble_from_character(int character) {
// Outputs the given HexFloat to the stream.
template
<
typename
T
,
typename
Traits
>
std
::
ostream
&
operator
<<
(
std
::
ostream
&
os
,
const
HexFloat
<
T
,
Traits
>&
value
)
{
using
HF
=
HexFloat
<
T
,
Traits
>
;
using
uint_
type
=
typename
HF
::
uint_type
;
using
int_
type
=
typename
HF
::
int_type
;
typedef
HexFloat
<
T
,
Traits
>
HF
;
type
def
typename
HF
::
uint_type
uint_type
;
type
def
typename
HF
::
int_type
int_type
;
static_assert
(
HF
::
num_used_bits
!=
0
,
"num_used_bits must be non-zero for a valid float"
);
...
...
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