logo separator

[mkgmap-dev] [PATCH] Bug in label encoding

From Toby Speight T.M.Speight.90 at cantab.net on Mon Feb 8 10:04:11 GMT 2010

0> In article <20100208071528.GA11669 at x60s>,
0> Marko Mäkelä <URL:mailto:marko.makela at iki.fi> ("Marko") wrote:

Marko> An integer version of your formula would also work in this case:
Marko>
Marko> 		int len = (off * 6 + 7) / 8 = 43/8 = 5.375 = 5
Marko>
Marko> This formula is clear to me: it will clearly convert the "off"
Marko> 6-byte chars (including the end-of-string code) to the number of
Marko> required 8-bit octets.

I'm with Marko here - this integer version is both computationally
efficient and clear in its intent.  That's the standard idiom for
rounded-up division.



More information about the mkgmap-dev mailing list