File tree Expand file tree Collapse file tree 1 file changed +9
-14
lines changed
Expand file tree Collapse file tree 1 file changed +9
-14
lines changed Original file line number Diff line number Diff line change @@ -21,26 +21,21 @@ class progress_display_t
2121{
2222 struct Counter
2323 {
24- osmid_t count = 0 ;
24+ std:: size_t count = 0 ;
2525 osmid_t max = 0 ;
2626 std::time_t start = 0 ;
27- int m_frac;
28-
29- explicit Counter (int frac) noexcept : m_frac(frac) {}
3027
3128 osmid_t count_k () const noexcept { return count / 1000 ; }
3229
33- bool add (osmid_t id) noexcept
30+ std:: size_t add (osmid_t id) noexcept
3431 {
3532 if (id > max) {
3633 max = id;
3734 }
3835 if (count == 0 ) {
3936 start = std::time (nullptr );
4037 }
41- ++count;
42-
43- return count % m_frac == 0 ;
38+ return ++count;
4439 }
4540
4641 Counter &operator +=(Counter const &rhs) noexcept
@@ -67,21 +62,21 @@ class progress_display_t
6762
6863 void add_node (osmid_t id)
6964 {
70- if (m_node.add (id)) {
65+ if (m_node.add (id) % 10000 == 0 ) {
7166 possibly_print_status ();
7267 }
7368 }
7469
7570 void add_way (osmid_t id)
7671 {
77- if (m_way.add (id)) {
72+ if (m_way.add (id) % 1000 == 0 ) {
7873 possibly_print_status ();
7974 }
8075 }
8176
8277 void add_rel (osmid_t id)
8378 {
84- if (m_rel.add (id)) {
79+ if (m_rel.add (id) % 10 == 0 ) {
8580 possibly_print_status ();
8681 }
8782 }
@@ -124,9 +119,9 @@ class progress_display_t
124119 return now - m_rel.start ;
125120 }
126121
127- Counter m_node{10000 };
128- Counter m_way{1000 };
129- Counter m_rel{10 };
122+ Counter m_node{};
123+ Counter m_way{};
124+ Counter m_rel{};
130125 std::time_t m_last_print_time;
131126};
132127
You can’t perform that action at this time.
0 commit comments