Re: [mkgmap-dev] methods to write signed / unsigned integers

Hi all, I've now committed the patches for mkgmap and display tool. If you use display tool r531 or later please make sure to use the latest mkgmap version from trunk. Gerd ________________________________________ Von: mkgmap-dev <mkgmap-dev-bounces@lists.mkgmap.org.uk> im Auftrag von Steve Ratcliffe <steve@parabola.me.uk> Gesendet: Dienstag, 17. April 2018 23:31:56 An: mkgmap-dev@lists.mkgmap.org.uk Betreff: Re: [mkgmap-dev] methods to write signed / unsigned integers Hi Gerd, Ticker
sorry for that. I waited for a comment from Steve and forgot about it. I'd still prefer that Steve gives an OK because he wrote most of the code that the patch changes.
I read through the patch and done some very simple tests and it looks OK to me. Hope someone has tested some really big maps. I think we should remove the commented out code and I noticed a few unneeded casts remaining (some maybe not actually as a result of the patch), and some javadoc errors. I've attached an incremental patch of the things I did, which you can take or leave as you wish. Lets get it committed. Its a big patch, thanks for going through all the cases and completing it. Steve

Hi Gerd & Steve I've done another pass through Display to remove lots of casts and masking. This required removed the overloading of Displayer.setBytes(byte/char/short/int) by having setBytes1/2/4() to match the existing setBytes3() DisplayItem.getValue() now returns the same value as fed in with setBytesX(), which also returns this value. I think Displayer.byteValue(), sByteValue, charValue should be changed to return this same int value, this will allow more casts/masks to be removed. In this pass I've tried to keep the exact same final output as the version before any of the IO changes. There are a few places that I've marked with %%% where I think the code is wrong, treating something as signed when it isn't. I don't have any DEM data for testing test.display.DemDisplay but I've done all the other sections. NodConvert gives Exception in thread "main" java.lang.AssertionError at test.display.NodConvert.pointerPart(NodConvert.java:274) if (first) { assert !newdir; but it did this for me with the pre-io-change version Regards Ticker

Hi Ticker, I've looked through the patch and I think that all places with %%% are indeed errors. I think I should fix those first. Will have a closer look today. Gerd ________________________________________ Von: mkgmap-dev <mkgmap-dev-bounces@lists.mkgmap.org.uk> im Auftrag von Ticker Berkin <rwb-mkgmap@jagit.co.uk> Gesendet: Dienstag, 24. April 2018 12:37:31 An: mkgmap-dev@lists.mkgmap.org.uk Betreff: Re: [mkgmap-dev] methods to write signed / unsigned integers Hi Gerd & Steve I've done another pass through Display to remove lots of casts and masking. This required removed the overloading of Displayer.setBytes(byte/char/short/int) by having setBytes1/2/4() to match the existing setBytes3() DisplayItem.getValue() now returns the same value as fed in with setBytesX(), which also returns this value. I think Displayer.byteValue(), sByteValue, charValue should be changed to return this same int value, this will allow more casts/masks to be removed. In this pass I've tried to keep the exact same final output as the version before any of the IO changes. There are a few places that I've marked with %%% where I think the code is wrong, treating something as signed when it isn't. I don't have any DEM data for testing test.display.DemDisplay but I've done all the other sections. NodConvert gives Exception in thread "main" java.lang.AssertionError at test.display.NodConvert.pointerPart(NodConvert.java:274) if (first) { assert !newdir; but it did this for me with the pre-io-change version Regards Ticker

Hi Gerd Another patch I've had hanging around is this. You've already taken a couple of fixes from it and there have been some unrelated changes that impact the same files and a fix to a mistake I made in the previous set of changes (sorry), so I can do another patch if you want. I've tested all the Display main entry points and get the same output. Looking thorough the patch I don't see any mistakes but do see the odd fix, mainly relating to changing signed 3 byte offsets to be unsigned; some of these won't ever have caused a problem because the top bits are used as flags and so get masked out. So, I hope it won't cause any additional problems. Regards Ticker On Tue, 2018-04-24 at 11:37 +0100, Ticker Berkin wrote:
Hi Gerd & Steve
I've done another pass through Display to remove lots of casts and masking.
This required removed the overloading of Displayer.setBytes(byte/char/short/int) by having setBytes1/2/4() to match the existing setBytes3()
DisplayItem.getValue() now returns the same value as fed in with setBytesX(), which also returns this value.
I think Displayer.byteValue(), sByteValue, charValue should be changed to return this same int value, this will allow more casts/masks to be removed.
In this pass I've tried to keep the exact same final output as the version before any of the IO changes. There are a few places that I've marked with %%% where I think the code is wrong, treating something as signed when it isn't.
I don't have any DEM data for testing test.display.DemDisplay but I've done all the other sections.
NodConvert gives Exception in thread "main" java.lang.AssertionError at test.display.NodConvert.pointerPart(NodConvert.java:274) if (first) { assert !newdir; but it did this for me with the pre-io-change version
Regards Ticker
_______________________________________________ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev

Hi Ticker, I am not sure what to do with NodConvert. I think the code is wrong, it fails on NOD with restrictions, but I never use the program so I don't want to invest the time to fix it. @Steve: What do you think? Gerd ________________________________________ Von: mkgmap-dev <mkgmap-dev-bounces@lists.mkgmap.org.uk> im Auftrag von Ticker Berkin <rwb-mkgmap@jagit.co.uk> Gesendet: Montag, 14. Mai 2018 13:29:18 An: Development list for mkgmap Betreff: Re: [mkgmap-dev] methods to write signed / unsigned integers Hi Gerd Another patch I've had hanging around is this. You've already taken a couple of fixes from it and there have been some unrelated changes that impact the same files and a fix to a mistake I made in the previous set of changes (sorry), so I can do another patch if you want. I've tested all the Display main entry points and get the same output. Looking thorough the patch I don't see any mistakes but do see the odd fix, mainly relating to changing signed 3 byte offsets to be unsigned; some of these won't ever have caused a problem because the top bits are used as flags and so get masked out. So, I hope it won't cause any additional problems. Regards Ticker On Tue, 2018-04-24 at 11:37 +0100, Ticker Berkin wrote:
Hi Gerd & Steve
I've done another pass through Display to remove lots of casts and masking.
This required removed the overloading of Displayer.setBytes(byte/char/short/int) by having setBytes1/2/4() to match the existing setBytes3()
DisplayItem.getValue() now returns the same value as fed in with setBytesX(), which also returns this value.
I think Displayer.byteValue(), sByteValue, charValue should be changed to return this same int value, this will allow more casts/masks to be removed.
In this pass I've tried to keep the exact same final output as the version before any of the IO changes. There are a few places that I've marked with %%% where I think the code is wrong, treating something as signed when it isn't.
I don't have any DEM data for testing test.display.DemDisplay but I've done all the other sections.
NodConvert gives Exception in thread "main" java.lang.AssertionError at test.display.NodConvert.pointerPart(NodConvert.java:274) if (first) { assert !newdir; but it did this for me with the pre-io-change version
Regards Ticker
_______________________________________________ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev

On 14/05/18 12:42, Gerd Petermann wrote:
I am not sure what to do with NodConvert. I think the code is wrong, it fails on NOD with restrictions, but I never use the program so I don't want to invest the time to fix it. @Steve: What do you think?
I have no interest in NodConvert, if it not useful just delete it.use. NodConvert is from 2008/9. When we improved routing in 2014 I used the test.svg.nod program to visualise the routing network. That is far more complete and useful. Steve

Hi Steve, Hi Ticker, okay, I've removed NodConvert. @Ticker: If you have a working patch based on r537, please post it. Gerd ________________________________________ Von: mkgmap-dev <mkgmap-dev-bounces@lists.mkgmap.org.uk> im Auftrag von Steve Ratcliffe <steve@parabola.me.uk> Gesendet: Montag, 14. Mai 2018 14:07:20 An: mkgmap-dev@lists.mkgmap.org.uk Betreff: Re: [mkgmap-dev] methods to write signed / unsigned integers On 14/05/18 12:42, Gerd Petermann wrote:
I am not sure what to do with NodConvert. I think the code is wrong, it fails on NOD with restrictions, but I never use the program so I don't want to invest the time to fix it. @Steve: What do you think?
I have no interest in NodConvert, if it not useful just delete it.use. NodConvert is from 2008/9. When we improved routing in 2014 I used the test.svg.nod program to visualise the routing network. That is far more complete and useful. Steve _______________________________________________ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev

Here is display patch based on r537 Ticker On Mon, 2018-05-14 at 12:18 +0000, Gerd Petermann wrote:
Hi Steve, Hi Ticker,
okay, I've removed NodConvert.
@Ticker: If you have a working patch based on r537, please post it.
Gerd
________________________________________ Von: mkgmap-dev <mkgmap-dev-bounces@lists.mkgmap.org.uk> im Auftrag von Steve Ratcliffe <steve@parabola.me.uk> Gesendet: Montag, 14. Mai 2018 14:07:20 An: mkgmap-dev@lists.mkgmap.org.uk Betreff: Re: [mkgmap-dev] methods to write signed / unsigned integers
On 14/05/18 12:42, Gerd Petermann wrote:
I am not sure what to do with NodConvert. I think the code is wrong, it fails on NOD with restrictions, but I never use the program so I don't want to invest the time to fix it. @Steve: What do you think?
I have no interest in NodConvert, if it not useful just delete it.use.
NodConvert is from 2008/9. When we improved routing in 2014 I used the test.svg.nod program to visualise the routing network. That is far more complete and useful.
Steve _______________________________________________ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev _______________________________________________ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev

Hi Ticker, will check today. I've just noted that we use put3s to write a bitmask in RouteNode.java. It probably cannot cause problems but I think it should be put3u. See attached patch. Gerd ________________________________________ Von: mkgmap-dev <mkgmap-dev-bounces@lists.mkgmap.org.uk> im Auftrag von Ticker Berkin <rwb-mkgmap@jagit.co.uk> Gesendet: Montag, 14. Mai 2018 14:48:01 An: Development list for mkgmap Betreff: Re: [mkgmap-dev] methods to write signed / unsigned integers Here is display patch based on r537 Ticker On Mon, 2018-05-14 at 12:18 +0000, Gerd Petermann wrote:
Hi Steve, Hi Ticker,
okay, I've removed NodConvert.
@Ticker: If you have a working patch based on r537, please post it.
Gerd
________________________________________ Von: mkgmap-dev <mkgmap-dev-bounces@lists.mkgmap.org.uk> im Auftrag von Steve Ratcliffe <steve@parabola.me.uk> Gesendet: Montag, 14. Mai 2018 14:07:20 An: mkgmap-dev@lists.mkgmap.org.uk Betreff: Re: [mkgmap-dev] methods to write signed / unsigned integers
On 14/05/18 12:42, Gerd Petermann wrote:
I am not sure what to do with NodConvert. I think the code is wrong, it fails on NOD with restrictions, but I never use the program so I don't want to invest the time to fix it. @Steve: What do you think?
I have no interest in NodConvert, if it not useful just delete it.use.
NodConvert is from 2008/9. When we improved routing in 2014 I used the test.svg.nod program to visualise the routing network. That is far more complete and useful.
Steve _______________________________________________ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev _______________________________________________ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev

Hi Gerd This case of composing 12bit lat and lon values into 3 bytes should use put3s() with the way the code is at the moment; the first val (latOff) is signed and shifting it preserves the sign so the whole thing is allowed to be negative. However: 1/ It would be clearer to mask both the lat and lon when composing the value, then it should use put3u 2/ Examples like this might suffer the +-180 degree problem you've noted in your other post. I think this one won't because they are offsets from a center. 3/ My preference is for flags and butmasks to be handled as unsigned, especially as a lot of them contain smaller unsigned values in the bottom bits Ticker On Tue, 2018-05-15 at 05:27 +0000, Gerd Petermann wrote:
Hi Ticker,
will check today. I've just noted that we use put3s to write a bitmask in RouteNode.java. It probably cannot cause problems but I think it should be put3u. See attached patch.
Gerd
________________________________________ Von: mkgmap-dev <mkgmap-dev-bounces@lists.mkgmap.org.uk> im Auftrag von Ticker Berkin <rwb-mkgmap@jagit.co.uk> Gesendet: Montag, 14. Mai 2018 14:48:01 An: Development list for mkgmap Betreff: Re: [mkgmap-dev] methods to write signed / unsigned integers
Here is display patch based on r537
Ticker
On Mon, 2018-05-14 at 12:18 +0000, Gerd Petermann wrote:
Hi Steve, Hi Ticker,
okay, I've removed NodConvert.
@Ticker: If you have a working patch based on r537, please post it.
Gerd
________________________________________ Von: mkgmap-dev <mkgmap-dev-bounces@lists.mkgmap.org.uk> im Auftrag von Steve Ratcliffe <steve@parabola.me.uk> Gesendet: Montag, 14. Mai 2018 14:07:20 An: mkgmap-dev@lists.mkgmap.org.uk Betreff: Re: [mkgmap-dev] methods to write signed / unsigned integers
On 14/05/18 12:42, Gerd Petermann wrote:
I am not sure what to do with NodConvert. I think the code is wrong, it fails on NOD with restrictions, but I never use the program so I don't want to invest the time to fix it. @Steve: What do you think?
I have no interest in NodConvert, if it not useful just delete it.use.
NodConvert is from 2008/9. When we improved routing in 2014 I used the test.svg.nod program to visualise the routing network. That is far more complete and useful.
Steve _______________________________________________ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev _______________________________________________ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
participants (4)
-
Gerd Petermann
-
Gerd Petermann
-
Steve Ratcliffe
-
Ticker Berkin