MCPcopy Create free account
hub / github.com/Kitware/VTK / DetectByteOrder

Method DetectByteOrder

IO/EnSight/core/EnSightFile.cxx:618–643  ·  view source on GitHub ↗

------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

616
617//------------------------------------------------------------------------------
618bool EnSightFile::DetectByteOrder(int* result)
619{
620 if (this->ByteOrder == Endianness::Unknown)
621 {
622 int tmpLE = *result;
623 int tmpBE = *result;
624 vtkByteSwap::Swap4LE(&tmpLE);
625 vtkByteSwap::Swap4BE(&tmpBE);
626
627 if (tmpLE >= 0 && tmpLE < MAXIMUM_PART_ID)
628 {
629 this->ByteOrder = Endianness::Little;
630 *result = tmpLE;
631 return true;
632 }
633 if (tmpBE >= 0 && tmpBE < MAXIMUM_PART_ID)
634 {
635 this->ByteOrder = Endianness::Big;
636 *result = tmpBE;
637 return true;
638 }
639 vtkGenericWarningMacro("Byte order could not be determined.");
640 return false;
641 }
642 return true;
643}
644
645//------------------------------------------------------------------------------
646void EnSightFile::MoveReadPosition(vtkTypeInt64 numBytes)

Callers 1

ReadPartIdMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected