XMHALF2 structure

A 2D vector consisting of two half-precision (16bit) floating-point values.

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

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

Syntax

struct XMHALF2 {
  union {
    struct {
      HALF x;
      HALF y;
    };
    uint32_t v;
  };
  void         XMHALF2();
  XM_CONSTEXPR XMHALF2( HALF _x, HALF _y);
  void         XMHALF2( const XMHALF2 & );
  void         XMHALF2( const HALF *pArray);
  XMHALF2 &    operator=( const XMHALF2 & );
  void         XMHALF2( float _x, float _y);
  void         XMHALF2( XMHALF2 && );
  void         XMHALF2( const float *pArray);
  XMHALF2 &    operator=( XMHALF2 && );
  XM_CONSTEXPR XMHALF2( uint32_t Packed);
  XMHALF2 &    operator=( uint32_t Packed);
};

Members

x

HALF value describing the x-coordinate.

y

HALF value describing the y-coordinate.

v

````cpp void XMHALF2()`

Default constructor for XMHALF2.

Default constructor for XMHALF2.

Note  This constructor is only available under C++.
 

````cpp XM_CONSTEXPR XMHALF2( HALF _x, HALF _y)`

Initializes a new instance of XMHALF2 from two HALF arguments.

This constructor initializes a new instance of XMHALF2 from two HALF arguments.

Note  This constructor is only available under C++.
 

````cpp void XMHALF2( const XMHALF2 & )`

A constructor for XMHALF2.

A constructor for XMHALF2.

Note  This constructor is only available under C++.

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

Initializes a new instance of XMHALF2 from a two element HALF array argument.

This constructor initializes a new instance of XMHALF2 from a two element HALF array argument.

Note  This constructor is only available under C++.

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

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

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

Note  This constructor is only available under C++.

````cpp void XMHALF2( float _x, float _y)`

Initializes a new instance of XMHALF2 from two float arguments.

This constructor initializes a new instance of XMHALF2 from two float arguments.

Note  This constructor is only available under C++.
 

````cpp void XMHALF2( XMHALF2 && )`

A constructor for XMHALF2.

A constructor for XMHALF2.

Note  This constructor is only available under C++.

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

Initializes a new instance of XMHALF2 from a two element float array argument.

This constructor initializes a new instance of** XMHALF2** from a two element float array argument.

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





[````cpp
XM_CONSTEXPR XMHALF2(  uint32_t Packed)`](nf-directxpackedvector-xmhalf2-xmhalf2(uint32_t).md)

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

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

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



````cpp
XMHALF2 & operator=(  uint32_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>XMHALF2</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-xmloadhalf2">XMLoadHalf2</a>.
	

Instances of <code>XMVECTOR</code> can be stored into an instance of <code>XMHALF2</code> with <a href="https://docs.microsoft.com/windows/desktop/api/directxpackedvector/nf-directxpackedvector-xmstorehalf2">XMStoreHalf2</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-xmhalf2-extensions">XMHALF2 Extensions</a>