Sha256: b1ad0979eec260364290b1e05b60c429d411e029106dd14bcbe663e09a78e00e

Contents?: true

Size: 1.36 KB

Versions: 24

Compression:

Stored size: 1.36 KB

Contents

// Copyright (c) 2017-2020 Dr. Colin Hirsch and Daniel Frey
// Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/

#ifndef TAO_JSON_PEGTL_INTERNAL_ENDIAN_HPP
#define TAO_JSON_PEGTL_INTERNAL_ENDIAN_HPP

#include <cstdint>
#include <cstring>

#include "../config.hpp"

#if defined( _WIN32 ) && !defined( __MINGW32__ )
#include "endian_win.hpp"
#else
#include "endian_gcc.hpp"
#endif

namespace TAO_JSON_PEGTL_NAMESPACE::internal
{
   template< typename N >
   [[nodiscard]] N h_to_be( const N n ) noexcept
   {
      return N( to_and_from_be< sizeof( N ) >::convert( n ) );
   }

   template< typename N >
   [[nodiscard]] N be_to_h( const N n ) noexcept
   {
      return h_to_be( n );
   }

   template< typename N >
   [[nodiscard]] N be_to_h( const void* p ) noexcept
   {
      N n;
      std::memcpy( &n, p, sizeof( n ) );
      return internal::be_to_h( n );
   }

   template< typename N >
   [[nodiscard]] N h_to_le( const N n ) noexcept
   {
      return N( to_and_from_le< sizeof( N ) >::convert( n ) );
   }

   template< typename N >
   [[nodiscard]] N le_to_h( const N n ) noexcept
   {
      return h_to_le( n );
   }

   template< typename N >
   [[nodiscard]] N le_to_h( const void* p ) noexcept
   {
      N n;
      std::memcpy( &n, p, sizeof( n ) );
      return internal::le_to_h( n );
   }

}  // namespace TAO_JSON_PEGTL_NAMESPACE::internal

#endif

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
couchbase-3.0.0-universal-darwin-19 ext/third_party/json/include/tao/json/external/pegtl/internal/endian.hpp
couchbase-3.0.0 ext/third_party/json/include/tao/json/external/pegtl/internal/endian.hpp
couchbase-3.0.0.beta.1-universal-darwin-19 ext/third_party/json/include/tao/json/external/pegtl/internal/endian.hpp
couchbase-3.0.0.beta.1 ext/third_party/json/include/tao/json/external/pegtl/internal/endian.hpp
couchbase-3.0.0.alpha.5-x86_64-linux ext/third_party/json/include/tao/json/external/pegtl/internal/endian.hpp
couchbase-3.0.0.alpha.5-universal-darwin-19 ext/third_party/json/include/tao/json/external/pegtl/internal/endian.hpp
couchbase-3.0.0.alpha.5-x86_64-darwin-19 ext/third_party/json/include/tao/json/external/pegtl/internal/endian.hpp
couchbase-3.0.0.alpha.5 ext/third_party/json/include/tao/json/external/pegtl/internal/endian.hpp
couchbase-3.0.0.alpha.4-x86_64-linux ext/third_party/json/include/tao/json/external/pegtl/internal/endian.hpp
couchbase-3.0.0.alpha.4-x86_64-darwin-19 ext/third_party/json/include/tao/json/external/pegtl/internal/endian.hpp
couchbase-3.0.0.alpha.4-universal-darwin-19 ext/third_party/json/include/tao/json/external/pegtl/internal/endian.hpp
couchbase-3.0.0.alpha.4 ext/third_party/json/include/tao/json/external/pegtl/internal/endian.hpp
couchbase-3.0.0.alpha.3-x86_64-linux ext/third_party/json/include/tao/json/external/pegtl/internal/endian.hpp
couchbase-3.0.0.alpha.3-x86_64-darwin-19 ext/third_party/json/include/tao/json/external/pegtl/internal/endian.hpp
couchbase-3.0.0.alpha.3-universal-darwin-19 ext/third_party/json/include/tao/json/external/pegtl/internal/endian.hpp
couchbase-3.0.0.alpha.3 ext/third_party/json/include/tao/json/external/pegtl/internal/endian.hpp
couchbase-3.0.0.alpha.2-x86_64-linux ext/third_party/json/include/tao/json/external/pegtl/internal/endian.hpp
couchbase-3.0.0.alpha.2-x86_64-darwin-19 ext/third_party/json/include/tao/json/external/pegtl/internal/endian.hpp
couchbase-3.0.0.alpha.2-universal-darwin-19 ext/third_party/json/include/tao/json/external/pegtl/internal/endian.hpp
couchbase-3.0.0.alpha.2 ext/third_party/json/include/tao/json/external/pegtl/internal/endian.hpp