Skip to content

Commit

Permalink
fix(WasmMapComponentType): Support 32-bit long
Browse files Browse the repository at this point in the history
In WASI.
  • Loading branch information
thewtex committed Feb 10, 2023
1 parent 5e6453c commit 860c963
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions include/itkWasmMapComponentType.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#define itkWasmMapComponentType_h

#include <string_view>
#include "itkIntTypes.h"

namespace itk
{
Expand Down Expand Up @@ -76,17 +77,33 @@ struct MapComponentType<unsigned int>
static constexpr std::string_view ComponentString = "uint32";
};

#if ((LLONG_MAX != LONG_MAX))
template <>
struct MapComponentType<long>
{
static constexpr std::string_view ComponentString = "int32";
};
#else
template <>
struct MapComponentType<long>
{
static constexpr std::string_view ComponentString = "int64";
};
#endif

#if ((ULLONG_MAX != ULONG_MAX))
template <>
struct MapComponentType<unsigned long>
{
static constexpr std::string_view ComponentString = "uint32";
};
#else
template <>
struct MapComponentType<unsigned long>
{
static constexpr std::string_view ComponentString = "uint64";
};
#endif

template <>
struct MapComponentType<long long>
Expand Down

0 comments on commit 860c963

Please sign in to comment.