Re: Fast UTF-8 strlen function



Frank Kotler wrote:

> I suppose... if we encounter a byte with the high bit clear,
> we just count "one". If we encounter a byte with the high
> bit set, we determine how many bits are set (look-up
> table?), and skip that many bytes, counting "one" for the
> whole mess... I don't see an "optimized" version of this
> working out very well...

Easy, if the first character is:
< 07fh single char encoding
080h -> 0deh double char encoding
0dfh -> 0efh triple char encoding
0f0h -> 0ffh quad char encoding

Based on one of these, you could skip ahead x places. However you still
need to consider or check for invalid UTF8 encodings, and also if Randy
want's combining characters counted or not-counted as separate
characters? (In which case, if he does, he then has to determine if the
character is a combining character or not).

--
Darran (aka Chewy509) brought to you by Google Groups!

.



Relevant Pages

  • Re: [4e] RE: Design and Development - The Zombie
    ... and it is a pain in the ass to weigh encounter strength when you throw a lot ... Of the guy playing the Wizard. ... A starting character does not have scrolls, ... How charged with punishment the scroll, ...
    (rec.games.frp.dnd)
  • Re: help interpreting Gleemax posts
    ... You can measure difficulty in a variety of ways - the odds of the party ... beating the encounter, the odds of a character death, the odds of a TPK) as ... I don't need a game restructued to make sure everyone gets ...
    (rec.games.frp.dnd)
  • Re: Review: 4th Ed
    ... [Spoilers for one encounter in Keep on the Shadowfell.] ... Insight check to notice the attackers' traitorous intentions, ... area of the character sheet. ... Since it is, in fact, completely impossible to explain marking in- ...
    (rec.games.frp.dnd)
  • Re: Skill Challenges - WTF?
    ... "In a skill challenge encounter, every player character must make ... to be smarter than Justin and/or not deliberately look for ways to ...
    (rec.games.frp.dnd)
  • Re: DR/magic: useless?
    ... meaning that DR/magic generally doesn't do anything at all during ... an encounter. ... character a use for all that gold that they are finding. ...
    (rec.games.frp.dnd)