Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

0033671: Coding - GeomTools performance update #19

Merged
merged 1 commit into from
Dec 21, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 13 additions & 8 deletions src/GeomTools/GeomTools.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -96,16 +96,21 @@ Handle(GeomTools_UndefinedTypeHandler) GeomTools::GetUndefinedTypeHandler()
//purpose :
//=======================================================================

void GeomTools::GetReal(Standard_IStream& IS,Standard_Real& theValue)
void GeomTools::GetReal(Standard_IStream& IS, Standard_Real& theValue)
{
theValue = 0.;
if (IS.eof())
if (IS.eof())
{
return;

char buffer[256];
buffer[0] = '\0';
std::streamsize anOldWide = IS.width(256);
IS >> buffer;
}
// According IEEE-754 Specification and standard stream parameters
// the most optimal buffer length not less then 25
constexpr size_t THE_BUFFER_SIZE = 32;
char aBuffer[THE_BUFFER_SIZE];

aBuffer[0] = '\0';
std::streamsize anOldWide = IS.width(THE_BUFFER_SIZE - 1);
IS >> aBuffer;
IS.width(anOldWide);
theValue = Strtod(buffer, NULL);
theValue = Strtod(aBuffer, nullptr);
}
Loading