sessiond: transition from lttng-ust to tracer agnostic API
[lttng-tools.git] / src / bin / lttng-sessiond / field.cpp
index 25f0e4676bf2f28aed15c311f218ac59a418ce9f..66087cfae2316b977324a9952b63c1919f55e7d0 100644 (file)
@@ -10,6 +10,8 @@
 #include <common/exception.hpp>
 #include <common/format.hpp>
 
+#include <set>
+
 namespace lst = lttng::sessiond::trace;
 
 namespace {
@@ -111,19 +113,16 @@ lst::floating_point_type::floating_point_type(unsigned int in_alignment,
        mantissa_digits(in_mantissa_digits)
 {
        /* Allowed (exponent, mantissa) pairs. */
-       static const std::vector<std::pair<unsigned int, unsigned int>> allowed_pairs{
+       static const std::set<std::pair<unsigned int, unsigned int>> allowed_pairs{
                        {5, 11}, /* binary16 */
                        {8, 24}, /* binary32 */
                        {11, 53}, /* binary64 */
                        {15, 113}, /* binary128 */
        };
 
-       const auto input_pair = decltype(allowed_pairs)::value_type(exponent_digits, mantissa_digits);
-       for (const auto& pair : allowed_pairs) {
-               if (input_pair == pair) {
-                       /* mantissa and exponent digits is a valid pair. */
-                       return;
-               }
+       if (allowed_pairs.find({exponent_digits, mantissa_digits}) != allowed_pairs.end()) {
+               /* mantissa and exponent digits is a valid pair. */
+               return;
        }
 
        LTTNG_THROW_INVALID_ARGUMENT_ERROR(
@@ -317,4 +316,4 @@ bool lst::variant_type::_is_equal(const type& base_other) const noexcept
 void lst::variant_type::accept(type_visitor& visitor) const
 {
        visitor.visit(*this);
-}
\ No newline at end of file
+}
This page took 0.023708 seconds and 4 git commands to generate.