MCPcopy Create free account
hub / github.com/PCSX2/pcsx2 / parseFloat

Function parseFloat

pcsx2/DebugTools/ExpressionParser.cpp:155–175  ·  view source on GitHub ↗

Parse only a float, and return as float bits.

Source from the content-addressed store, hash-verified

153
154// Parse only a float, and return as float bits.
155static bool parseFloat(const char *str, int len, u64 &result)
156{
157 bool foundDecimal = false;
158 for (int i = 0; i < len; ++i)
159 {
160 if (str[i] == '.')
161 {
162 if (foundDecimal)
163 return false;
164 foundDecimal = true;
165 continue;
166 }
167 if (str[i] < '0' || str[i] > '9')
168 return false;
169 }
170
171 result = 0;
172 float f = (float)atof(str);
173 memcpy(&result, &f, sizeof(float));
174 return foundDecimal;
175}
176
177ExpressionOpcodeType getExpressionOpcode(const char* str, int& ReturnLen, ExpressionOpcodeType LastOpcode)
178{

Callers 1

initPostfixExpressionFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected