
8 Feb
2010
8 Feb
'10
10:04 a.m.
0> In article <20100208071528.GA11669@x60s>, 0> Marko Mäkelä <URL:mailto:marko.makela@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.