<commit_before>//protozero
#include <protozero/pbf_reader.hpp>

//mapnik
#include <mapnik/geometry/box2d.hpp>
#include <mapnik/geometry.hpp>
#if defined(DEBUG)
#include <mapnik/debug.hpp>
#endif

//std
#include <algorithm>
#include <cmath>
#include <stdexcept>

namespace mapnik
{

namespace vector_tile_impl
{

namespace detail
{

template <typename value_type>
inline double calculate_segment_area(value_type const x0, value_type const y0, value_type const x1, value_type const y1)
{
    return (static_cast<double>(x0) * static_cast<double>(y1)) - (static_cast<double>(y0) * static_cast<double>(x1));
}

inline bool area_is_clockwise(double area)
{
    return (area < 0.0);
}

template <typename value_type>
inline bool scaling_reversed_orientation(value_type const scale_x_, value_type const scale_y_)
{
    return (scale_x_ * scale_y_) < 0;
}

template <typename value_type>
inline void move_cursor(value_type & x, value_type & y, std::int32_t dx, std::int32_t dy)
{
    x += static_cast<value_type>(dx);
    y += static_cast<value_type>(dy);
}


template <typename value_type>
inline value_type get_point_value(value_type const val,
                                  double const scale_val,
                                  double const tile_loc)
{
    return (tile_loc + static_cast<value_type>(std::round(static_cast<double>(val) / scale_val)));
}

template <>
inline double get_point_value<double>(double const val,
                                      double const scale_val,
                                      double const tile_loc)
{
    return tile_loc + (val / scale_val);
}

constexpr std::size_t max_reserve()
{
    // Based on int64_t geometry being 16 bytes in size and 
    // maximum allocation size of 10 MB.
    return (10 * 1024 * 1024) / 16;
}

template <typename geom_value_type>
void decode_point(mapnik::geometry::geometry<geom_value_type> & geom,
                  GeometryPBF & paths,
                  geom_value_type const tile_x,
                  geom_value_type const tile_y,
                  double const scale_x,
                  double const scale_y,
                  mapnik::box2d<double> const& bbox)
{
    typename GeometryPBF::command cmd;
    using pbf_value_type = GeometryPBF::value_type;
    pbf_value_type x1, y1;
    mapnik::geometry::multi_point<geom_value_type> mp;
    #if defined(DEBUG)
    std::uint32_t previous_len = 0;
    #endif
    // Find first moveto inside bbox and then reserve points from size of geometry.
    while (true)
    {
        cmd = paths.point_next(x1, y1);<commit_msg>Changed max reserve to 1mb instead of 10mb<commit_after>//protozero
#include <protozero/pbf_reader.hpp>

//mapnik
#include <mapnik/geometry/box2d.hpp>
#include <mapnik/geometry.hpp>
#if defined(DEBUG)
#include <mapnik/debug.hpp>
#endif

//std
#include <algorithm>
#include <cmath>
#include <stdexcept>

namespace mapnik
{

namespace vector_tile_impl
{

namespace detail
{

template <typename value_type>
inline double calculate_segment_area(value_type const x0, value_type const y0, value_type const x1, value_type const y1)
{
    return (static_cast<double>(x0) * static_cast<double>(y1)) - (static_cast<double>(y0) * static_cast<double>(x1));
}

inline bool area_is_clockwise(double area)
{
    return (area < 0.0);
}

template <typename value_type>
inline bool scaling_reversed_orientation(value_type const scale_x_, value_type const scale_y_)
{
    return (scale_x_ * scale_y_) < 0;
}

template <typename value_type>
inline void move_cursor(value_type & x, value_type & y, std::int32_t dx, std::int32_t dy)
{
    x += static_cast<value_type>(dx);
    y += static_cast<value_type>(dy);
}


template <typename value_type>
inline value_type get_point_value(value_type const val,
                                  double const scale_val,
                                  double const tile_loc)
{
    return (tile_loc + static_cast<value_type>(std::round(static_cast<double>(val) / scale_val)));
}

template <>
inline double get_point_value<double>(double const val,
                                      double const scale_val,
                                      double const tile_loc)
{
    return tile_loc + (val / scale_val);
}

constexpr std::size_t max_reserve()
{
    // Based on int64_t geometry being 16 bytes in size and 
    // maximum allocation size of 1 MB.
    return (1024 * 1024) / 16;
}

template <typename geom_value_type>
void decode_point(mapnik::geometry::geometry<geom_value_type> & geom,
                  GeometryPBF & paths,
                  geom_value_type const tile_x,
                  geom_value_type const tile_y,
                  double const scale_x,
                  double const scale_y,
                  mapnik::box2d<double> const& bbox)
{
    typename GeometryPBF::command cmd;
    using pbf_value_type = GeometryPBF::value_type;
    pbf_value_type x1, y1;
    mapnik::geometry::multi_point<geom_value_type> mp;
    #if defined(DEBUG)
    std::uint32_t previous_len = 0;
    #endif
    // Find first moveto inside bbox and then reserve points from size of geometry.
    while (true)
    {
        cmd = paths.point_next(x1, y1);
{'fraction_non_alphanumeric': 0.09580487804878049, 'fraction_numerical': 0.016390243902439025, 'mean_word_length': 3.0425867507886437, 'pattern_counts': {'":': 0, '<': 57, '<?xml version=': 0, '>': 53, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4875382', 'n_tokens_mistral': 1704, 'n_tokens_neox': 1617, 'n_words': 411}