.. # split from OESystemFunctions.rst:1272

.. include:: ../substitutions
.. include:: ../../toolkit-substitutions

.. oe:namespace:: OESystem

.. meta::
   :keywords: OEGetHostEndian

.. attention::

   |CPPONLY|

.. oe:function:: OEGetHostEndian

   .. oe:api::

      template<class T>
      unsigned char OEGetHostEndian()
      template<>
      unsigned char OEGetHostEndian<int>()
      template<>
      unsigned char OEGetHostEndian<unsigned int>()
      template<>
      unsigned char OEGetHostEndian<float>()
      template<>
      unsigned char OEGetHostEndian<double>()
      template<>
      unsigned char OEGetHostEndian<short>()
      template<>
      unsigned char OEGetHostEndian<oefpos_t>()
      template<>
      unsigned char OEGetHostEndian<OEPlatform::OEHalfFloat>()

   Returns the endianness of this machine so it can be encoded to a
   binary output file. The byte is used to indicate whether multi-byte
   binary values will need to be swapped when read on a different
   machine.

   .. seealso::

      Designed to work in conjunction with
      :oe:func:`OESystem::OEGetFileEndian`. The byte returned by
      :oe:func:`OESystem::OEGetHostEndian` should be written to the
      output file, then :oe:func:`OESystem::OEGetFileEndian` will
      determine whether the bytes of the given type ``T`` need to be
      swapped while being read by :oe:func:`OESystem::OEBReadData`.


