From 5f54d560a74972ff5f446b37bd0d5f5f78b7187f Mon Sep 17 00:00:00 2001 From: John Date: Sun, 23 Jan 2022 17:55:37 +0100 Subject: [PATCH] optimized --- src/lib/ebus/data.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/lib/ebus/data.cpp b/src/lib/ebus/data.cpp index 6b21a183..5f60f0e4 100644 --- a/src/lib/ebus/data.cpp +++ b/src/lib/ebus/data.cpp @@ -708,16 +708,16 @@ result_t ValueListDataField::derive(const string& name, PartType partType, int d if (!m_dataType->isNumeric()) { return RESULT_ERR_INVALID_ARG; } + const NumberDataType* num = reinterpret_cast(m_dataType); if (!values.empty()) { - const NumberDataType* num = reinterpret_cast(m_dataType); if (values.begin()->first < num->getMinValue() || values.rbegin()->first > num->getMaxValue()) { return RESULT_ERR_INVALID_ARG; // cannot use divisor != 1 for value list field } fields->push_back(new ValueListDataField(useName, *attributes, - reinterpret_cast(m_dataType), partType, m_length, values)); + num, partType, m_length, values)); } else { fields->push_back(new ValueListDataField(useName, *attributes, - reinterpret_cast(m_dataType), partType, m_length, m_values)); + num, partType, m_length, m_values)); } return RESULT_OK; }