XMHALF4 structure

Describes a 4D vector consisting of four half-precision (16-bit) floating-point values.

For a list of additional functionality such as constructors and operators that are available using XMHALF4 when you are programming in C++, see XMHALF4 Extensions.

Note  See DirectXMath Library Type Equivalences for information about equivalent D3DDECLTYPE, D3DFORMAT, and DXGI_FORMAT objects.
 

Syntax

struct XMHALF4 {
  union {
    struct {
      HALF x;
      HALF y;
      HALF z;
      HALF w;
    };
    uint64_t v;
  };
  void         XMHALF4();
  XM_CONSTEXPR XMHALF4( HALF _x, HALF _y, HALF _z, HALF _w);
  void         XMHALF4( const XMHALF4 & );
  void         XMHALF4( const HALF *pArray);
  XMHALF4 &    operator=( const XMHALF4 & );
  void         XMHALF4( float _x, float _y, float _z, float _w);
  void         XMHALF4( XMHALF4 && );
  void         XMHALF4( const float *pArray);
  XMHALF4 &    operator=( XMHALF4 && );
  XM_CONSTEXPR XMHALF4( uint64_t Packed);
  XMHALF4 &    operator=( uint64_t Packed);
};

Members

x

HALF value describing the x-coordinate.

y

HALF value describing the y-coordinate.

z

HALF value describing the z-coordinate.

w

HALF value describing the w-coordinate.

v

````cpp void XMHALF4()`

Default constructor for XMHALF4.

Default constructor for XMHALF4.

Note  This constructor is only available under C++.
 

````cpp XM_CONSTEXPR XMHALF4( HALF _x, HALF _y, HALF _z, HALF _w)`

Initializes a new instance of XMHALF4 from four HALF arguments.

This constructor initializes a new instance of XMHALF4 from four HALF arguments.

Note  This constructor is only available under C++.
 

````cpp void XMHALF4( const XMHALF4 & )`

A constructor for XMHALF4.

A constructor for XMHALF4.

Note  This constructor is only available under C++.

````cpp void XMHALF4( const HALF *pArray)`

Initializes a new instance of XMHALF4 from a four element HALF array argument.

This constructor initializes a new instance of XMHALF4 from a from a four element XMHALF4 array argument.

Note  This constructor is only available under C++.

````cpp XMHALF4 & operator=( const XMHALF4 & )`

Assigns the vector component data from one instance of XMHALF4 to the current instance of XMHALF4.

This operator assigns the vector component data from one instance of XMHALF4 to the current instance of XMHALF4.

Note  This constructor is only available under C++.

````cpp void XMHALF4( float _x, float _y, float _z, float _w)`

Initializes a new instance of XMHALF4 from four float arguments.

This constructor initializes a new instance of XMHALF4 from four float arguments.

Note  This constructor is only available under C++.
 

````cpp void XMHALF4( XMHALF4 && )`

A constructor for XMHALF4.

A constructor for XMHALF4.

Note  This constructor is only available under C++.

````cpp void XMHALF4( const float *pArray)`

Initializes a new instance of XMHALF4 from a four element float array argument.

This constructor initializes a new instance of XMHALF4 from a four element float array argument.

Note  This constructor is only available under C++.
XMHALF4 & operator=(  XMHALF4 && )`





[````cpp
XM_CONSTEXPR XMHALF4(  uint64_t Packed)`](nf-directxpackedvector-xmhalf4-xmhalf4(uint64_t).md)

A constructor for <code>XMHALF4</code>.

A constructor for <a href="https://docs.microsoft.com/windows/desktop/api/directxpackedvector/ns-directxpackedvector-xmhalf4">XMHALF4</a>.

<div class="alert"><b>Note</b>  This constructor is only available under C++.</div>



````cpp
XMHALF4 & operator=(  uint64_t Packed)`




## Remarks
The definition of the <code>HALF</code> type used under DirectXMath is consistent with the <a href="https://ieeexplore.ieee.org/xpl/freeabs_all.jsp?arnumber=4610935">IEEE
	    standard</a>, and consists of a sign bit, a 5 bit biased exponent, and a 10 bit
	    mantissa:
	


```

                    [15] SEEEEEMMMMMMMMMM [0]
	
```


<code>XMHALF4</code> can be loaded into instances of <a href="https://docs.microsoft.com/windows/desktop/dxmath/xmvector-data-type"> XMVECTOR</a> by
	    using <a href="https://docs.microsoft.com/en-us/windows/desktop/api/directxpackedvector/nf-directxpackedvector-xmloadhalf4">XMLoadHalf4</a>.
	

Instances of <code>XMVECTOR</code> can be stored into an instance of <code>XMHALF4</code> with <a href="https://docs.microsoft.com/windows/desktop/api/directxpackedvector/nf-directxpackedvector-xmstorehalf4">XMStoreHalf4</a>.
	

<b>Namespace:</b> Use DirectX::PackedVector

<h3><a id="Platform_Requirements"></a><a id="platform_requirements"></a><a id="PLATFORM_REQUIREMENTS"></a>Platform Requirements</h3>
Microsoft Visual Studio 2010 or Microsoft Visual Studio 2012 with the Windows SDK for Windows 8. Supported for Win32 desktop apps, Windows Store apps, and Windows Phone 8 apps.


## Requirements
| &nbsp; | &nbsp; |
| ---- |:---- |
| **Header** | directxpackedvector.h |

## See Also

<a href="https://docs.microsoft.com/windows/desktop/dxmath/ovw-xnamath-reference-structures">DirectXMath Library Structures</a>



<a href="https://docs.microsoft.com/windows/desktop/dxmath/ovw-xmhalf4-extensions">XMHALF4 Extensions</a>