@@ -575,42 +575,3 @@ geom::geometry_t ewkb_to_geom(std::string_view wkb)
575575
576576 return geom;
577577}
578-
579- namespace {
580-
581- constexpr std::array<char , 256 > const HEX_TABLE = {
582- 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ,
583- 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ,
584- 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ,
585- 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 0 , 0 , 0 , 0 , 0 , 0 ,
586-
587- 0 , 10 , 11 , 12 , 13 , 14 , 15 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ,
588- 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ,
589- 0 , 10 , 11 , 12 , 13 , 14 , 15 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ,
590- };
591-
592- } // anonymous namespace
593-
594- unsigned char decode_hex_char (char c) noexcept
595- {
596- // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-constant-array-index)
597- return HEX_TABLE[static_cast <std::size_t >(static_cast <unsigned char >(c))];
598- }
599-
600- std::string decode_hex (std::string_view hex_string)
601- {
602- if (hex_string.size () % 2 != 0 ) {
603- throw std::runtime_error{" Invalid wkb: Not a valid hex string" };
604- }
605-
606- std::string wkb;
607- wkb.reserve (hex_string.size () / 2 );
608-
609- // NOLINTNEXTLINE(llvm-qualified-auto, readability-qualified-auto)
610- for (auto hex = hex_string.begin (); hex != hex_string.end ();) {
611- unsigned int const c = decode_hex_char (*hex++);
612- wkb += static_cast <char >((c << 4U ) | decode_hex_char (*hex++));
613- }
614-
615- return wkb;
616- }
0 commit comments