| 114 | inline int optional_i32(const Value & object, const std::string & key, int default_value) { |
| 115 | return static_cast<int>(optional_i64(object, key, default_value)); |
| 116 | } |
| 117 | |
| 118 | inline float optional_f32(const Value & object, const std::string & key, float default_value) { |
| 119 | const auto * value = object.find(key); |
| 120 | return value != nullptr && value->is_number() ? value->as_f32() : default_value; |
| 121 | } |
| 122 |