Functions | |
void | setmem (void *mem, const void *value, unsigned value_size, size_t num_elem) |
Similar to memset, but accepts values larger than 1 char. More... | |
long | filesize (FILE *filp) |
Get size of file (if it is a regular file) More... | |
long | filesize (std::ifstream &str) |
Get size of file (if it is a regular file) More... | |
void | byteswap (void *data, unsigned value_size, size_t num_elem) |
Swap byte order (e.g. change from big-endian to little-endian) More... | |
static uint16_t | swap_bytes (uint16_t value) |
static uint32_t | swap_bytes (uint32_t value) |
static uint64_t | swap_bytes (uint64_t value) |
void | byteswap2 (void *data, size_t num_elem) |
Alternate byteswap optimized for 2-byte values. More... | |
void | byteswap4 (void *data, size_t num_elem) |
Alternate byteswap optimized for 4-byte values. More... | |
void | byteswap8 (void *data, size_t num_elem) |
Alternate byteswap optimized for 8-byte values. More... | |
bool | little_endian () |
Check if platform is little-endian. More... | |
bool | big_endian () |
Check if platform is big-endian. More... | |
template<typename T > | |
void | byteswap (T *data, size_t num_elem) |
Type-specific byte swap. More... | |
Variables | |
const uint64_t | m64b1 = 0xFF |
const uint64_t | m64b2 = m64b1 << 8 |
const uint64_t | m64b3 = m64b1 << 16 |
const uint64_t | m64b4 = m64b1 << 24 |
const uint64_t | m64b5 = m64b1 << 32 |
const uint64_t | m64b6 = m64b1 << 40 |
const uint64_t | m64b7 = m64b1 << 48 |
|
inline |
Check if platform is big-endian.
Check if platform is big-endian (least significant byte at lowest memory address.)
Definition at line 61 of file SysUtil.hpp.
Referenced by moab::ReadSTL::load_file(), and moab::WriteSTL::write_file().
|
inline |
Type-specific byte swap.
Definition at line 85 of file SysUtil.hpp.
References byteswap(), byteswap2(), byteswap4(), and byteswap8().
void moab::SysUtil::byteswap | ( | void * | data, |
unsigned | value_size, | ||
size_t | num_elem | ||
) |
Swap byte order (e.g. change from big-endian to little-endian)
Reverse byte order or array of values.
data | Pointer to beginning of memory block to modify |
values_size | Size of one value |
num_elem | Number of values of size 'value_size' in 'data' |
Definition at line 57 of file SysUtil.cpp.
Referenced by moab::ReadSTL::binary_read_triangles(), moab::WriteSTL::binary_write_triangles(), and byteswap().
void moab::SysUtil::byteswap2 | ( | void * | data, |
size_t | num_elem | ||
) |
Alternate byteswap optimized for 2-byte values.
Definition at line 128 of file SysUtil.cpp.
References swap_bytes().
Referenced by byteswap().
void moab::SysUtil::byteswap4 | ( | void * | data, |
size_t | num_elem | ||
) |
Alternate byteswap optimized for 4-byte values.
Definition at line 136 of file SysUtil.cpp.
References swap_bytes().
Referenced by byteswap().
void moab::SysUtil::byteswap8 | ( | void * | data, |
size_t | num_elem | ||
) |
Alternate byteswap optimized for 8-byte values.
Definition at line 144 of file SysUtil.cpp.
References swap_bytes().
Referenced by byteswap().
long moab::SysUtil::filesize | ( | FILE * | filp | ) |
Get size of file (if it is a regular file)
Get size of regular file.
Definition at line 27 of file SysUtil.cpp.
References length().
Referenced by moab::ReadSTL::binary_read_triangles().
long moab::SysUtil::filesize | ( | std::ifstream & | str | ) |
Get size of file (if it is a regular file)
Get size of regular file.
Definition at line 42 of file SysUtil.cpp.
References length().
|
inline |
Check if platform is little-endian.
Check if platform is little-endian (least significant byte at highest memory address.)
Definition at line 50 of file SysUtil.hpp.
Referenced by moab::ReadSTL::binary_read_triangles(), moab::WriteSTL::binary_write_triangles(), moab::ReadSTL::load_file(), and moab::WriteSTL::write_file().
void moab::SysUtil::setmem | ( | void * | mem, |
const void * | value, | ||
unsigned | value_size, | ||
size_t | num_elem | ||
) |
Similar to memset, but accepts values larger than 1 char.
Set block of memory to repeating copies of a sequene of bytes.
mem | Pointer to start of memory block to initialize |
value | Byte sequence to initialize mem with |
value_size | Size of 'value' |
num_elem | Size of 'mem' as a multiple of value_size (the number of copies of 'value' to write into 'mem'.) |
Definition at line 15 of file SysUtil.cpp.
Referenced by moab::DenseTag::clear_data(), moab::SequenceData::create_data(), moab::SparseTag::get_data(), moab::MeshTag::get_data(), moab::VarLenDenseTag::get_data(), moab::DenseTag::get_data(), and moab::WriteVtk::write_tag().
|
inlinestatic |
Definition at line 69 of file SysUtil.cpp.
Referenced by moab::ReadSTL::binary_read_triangles(), moab::WriteSTL::binary_write_triangles(), byteswap2(), byteswap4(), and byteswap8().
|
inlinestatic |
Definition at line 74 of file SysUtil.cpp.
|
inlinestatic |
Definition at line 89 of file SysUtil.cpp.
const uint64_t moab::SysUtil::m64b1 = 0xFF |
Definition at line 80 of file SysUtil.cpp.
const uint64_t moab::SysUtil::m64b2 = m64b1 << 8 |
Definition at line 81 of file SysUtil.cpp.
Referenced by swap_bytes().
const uint64_t moab::SysUtil::m64b3 = m64b1 << 16 |
Definition at line 82 of file SysUtil.cpp.
Referenced by swap_bytes().
const uint64_t moab::SysUtil::m64b4 = m64b1 << 24 |
Definition at line 83 of file SysUtil.cpp.
Referenced by swap_bytes().
const uint64_t moab::SysUtil::m64b5 = m64b1 << 32 |
Definition at line 84 of file SysUtil.cpp.
Referenced by swap_bytes().
const uint64_t moab::SysUtil::m64b6 = m64b1 << 40 |
Definition at line 85 of file SysUtil.cpp.
Referenced by swap_bytes().
const uint64_t moab::SysUtil::m64b7 = m64b1 << 48 |
Definition at line 86 of file SysUtil.cpp.
Referenced by swap_bytes().