MCPcopy Create free account
hub / github.com/Vector35/binaryninja-api / asFloat

Method asFloat

json/jsoncpp.cpp:3285–3306  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3283}
3284
3285float Value::asFloat() const {
3286 switch (type_) {
3287 case intValue:
3288 return static_cast<float>(value_.int_);
3289 case uintValue:
3290#if !defined(JSON_USE_INT64_DOUBLE_CONVERSION)
3291 return static_cast<float>(value_.uint_);
3292#else // if !defined(JSON_USE_INT64_DOUBLE_CONVERSION)
3293 // This can fail (silently?) if the value is bigger than MAX_FLOAT.
3294 return static_cast<float>(integerToDouble(value_.uint_));
3295#endif // if !defined(JSON_USE_INT64_DOUBLE_CONVERSION)
3296 case realValue:
3297 return static_cast<float>(value_.real_);
3298 case nullValue:
3299 return 0.0;
3300 case booleanValue:
3301 return value_.bool_ ? 1.0f : 0.0f;
3302 default:
3303 break;
3304 }
3305 JSON_FAIL_MESSAGE("Value is not convertible to float.");
3306}
3307
3308bool Value::asBool() const {
3309 switch (type_) {

Callers

nothing calls this directly

Calls 1

integerToDoubleFunction · 0.85

Tested by

no test coverage detected