1 #ifndef AMREX_INTCONV_H_
2 #define AMREX_INTCONV_H_
3 #include <AMReX_Config.H>
14 std::int16_t
swapBytes (std::int16_t value);
15 std::int32_t
swapBytes (std::int32_t value);
16 std::int64_t
swapBytes (std::int64_t value);
18 std::uint16_t
swapBytes (std::uint16_t value);
19 std::uint32_t
swapBytes (std::uint32_t value);
20 std::uint64_t
swapBytes (std::uint64_t value);
22 template <
typename To,
typename From>
28 for (std::size_t j = 0; j <
size; ++j) {
29 value =
static_cast<To
>(data[j]);
30 if (swapEndian) { value =
swapBytes(value); }
31 os.write((
char*) &value,
sizeof(To));
35 template <
typename To,
typename From>
41 for (std::size_t j = 0; j <
size; ++j) {
42 is.read((
char*) &value,
sizeof(From));
43 if (swapEndian) { value =
swapBytes(value); }
44 data[j] =
static_cast<To
>(value);
static const IntDescriptor & NativeIntDescriptor()
Returns a constant reference to an IntDescriptor describing the native "int" under which AMReX was co...
Definition: AMReX_FPC.cpp:76
A Descriptor of the Long Integer type.
Definition: AMReX_FabConv.H:29
Ordering order() const
Returns the ordering.
Definition: AMReX_FabConv.cpp:26
AMREX_GPU_HOST_DEVICE Long size(T const &b) noexcept
integer version
Definition: AMReX_GpuRange.H:26
Definition: AMReX_Amr.cpp:49
void writeIntData(const From *data, std::size_t size, std::ostream &os, const amrex::IntDescriptor &id)
Definition: AMReX_IntConv.H:23
std::int16_t swapBytes(std::int16_t val)
Definition: AMReX_IntConv.cpp:5
void readIntData(To *data, std::size_t size, std::istream &is, const amrex::IntDescriptor &id)
Definition: AMReX_IntConv.H:36