<p><b>@mmd-osm</b> commented on this pull request.</p>
<hr>
<p>In <a href="https://github.com/openstreetmap/osm2pgsql/pull/956#discussion_r330184380">table.cpp</a>:</p>
<pre style='color:#555'>> m_copy.add_column(from);
} else if (items == 2) {
- m_copy.add_column((from + to) / 2);
+ // calculate mean while avoiding overflows
+ int64_t mean = (from / 2) + (to / 2) + ((from % 2 + to % 2) / 2);
</pre>
<p>How about <code>from + ( (to - from) / 2)</code>, assuming <em>to</em> and <em>from</em> are positive and <em>from <= to</em>?</p>
<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/openstreetmap/osm2pgsql/pull/956?email_source=notifications&email_token=AA6353S7S6QGAWXZWOS72HDQMODFPA5CNFSM4I3YC4KKYY3PNVWWK3TUL52HS4DFWFIHK3DMKJSXC5LFON2FEZLWNFSXPKTDN5WW2ZLOORPWSZGOCGQSJHY#pullrequestreview-295773343">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AA6353RYOZNOQ5MGMZZSX63QMODFPANCNFSM4I3YC4KA">mute the thread</a>.<img src="https://github.com/notifications/beacon/AA6353TTO7UTZFOZ3DMSBVLQMODFPA5CNFSM4I3YC4KKYY3PNVWWK3TUL52HS4DFWFIHK3DMKJSXC5LFON2FEZLWNFSXPKTDN5WW2ZLOORPWSZGOCGQSJHY.gif" height="1" width="1" alt="" /></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/openstreetmap/osm2pgsql/pull/956?email_source=notifications\u0026email_token=AA6353S7S6QGAWXZWOS72HDQMODFPA5CNFSM4I3YC4KKYY3PNVWWK3TUL52HS4DFWFIHK3DMKJSXC5LFON2FEZLWNFSXPKTDN5WW2ZLOORPWSZGOCGQSJHY#pullrequestreview-295773343",
"url": "https://github.com/openstreetmap/osm2pgsql/pull/956?email_source=notifications\u0026email_token=AA6353S7S6QGAWXZWOS72HDQMODFPA5CNFSM4I3YC4KKYY3PNVWWK3TUL52HS4DFWFIHK3DMKJSXC5LFON2FEZLWNFSXPKTDN5WW2ZLOORPWSZGOCGQSJHY#pullrequestreview-295773343",
"name": "View Pull Request"
},
"description": "View this Pull Request on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>