HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
half.h
Go to the documentation of this file.
1 //
2 // Copyright 2016 Pixar
3 //
4 // Licensed under the terms set forth in the LICENSE.txt file available at
5 // https://openusd.org/license.
6 //
7 #ifndef PXR_BASE_GF_HALF_H
8 #define PXR_BASE_GF_HALF_H
9 
10 /// \file gf/half.h
11 ///
12 /// This header serves to simply bring in the half float datatype and
13 /// provide a hash_value function. For documentation, of the half type,
14 /// please see the half header in ilmbase_half.h.
15 
16 #include "pxr/pxr.h"
19 #include "pxr/base/gf/traits.h"
20 
21 #include <cstddef>
22 
24 
25 /// A 16-bit floating point data type.
27 
28 namespace pxr_half {
29  /// Overload hash_value for half.
30  inline std::size_t hash_value(const half h) { return h.bits(); }
31  // Explicitly delete hashing via implicit conversion of half to float
32  std::size_t hash_value(float) = delete;
33 }
34 
35 template <>
37  public std::integral_constant<bool, true>{};
38 
40 
41 
42 #endif // PXR_BASE_GF_HALF_H
GF_API unsigned short bits() const
Definition: ilmbase_half.h:743
imath_half_bits_t half
if we're in a C-only context, alias the half bits type to half
Definition: half.h:266
GLfloat GLfloat GLfloat GLfloat h
Definition: glcorearb.h:2002
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
Definition: path.h:1425
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:74
std::size_t hash_value(const half h)
Overload hash_value for half.
Definition: half.h:30