| 60 | } |
| 61 | |
| 62 | void amrex::writeLongData (const Long* data, std::size_t size, std::ostream& os, |
| 63 | const IntDescriptor& id) |
| 64 | { |
| 65 | if (id == FPC::NativeLongDescriptor()) |
| 66 | { |
| 67 | if (!os.write(reinterpret_cast<char const*>(data), |
| 68 | static_cast<std::streamsize>(size*sizeof(Long)))) |
| 69 | { |
| 70 | amrex::Error("Failed to write long integer data."); |
| 71 | } |
| 72 | } |
| 73 | else if (id.numBytes() == 2) |
| 74 | { |
| 75 | writeIntData<std::int16_t, Long>(data, size, os, id); |
| 76 | } |
| 77 | else if (id.numBytes() == 4) |
| 78 | { |
| 79 | writeIntData<std::int32_t, Long>(data, size, os, id); |
| 80 | } |
| 81 | else if (id.numBytes() == 8) |
| 82 | { |
| 83 | writeIntData<std::int64_t, Long>(data, size, os, id); |
| 84 | } |
| 85 | else { |
| 86 | amrex::Error("Don't know how to work with this long type."); |
| 87 | } |
| 88 | } |
| 89 | |
| 90 | void amrex::readLongData (Long* data, std::size_t size, std::istream& is, |
| 91 | const IntDescriptor& id) |