~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/utf8/utf8.h

  • Committer: Monty Taylor
  • Date: 2010-06-03 20:32:37 UTC
  • mfrom: (1587 build)
  • mto: (1596.1.1 build)
  • mto: This revision was merged to the branch mainline in revision 1597.
  • Revision ID: mordred@inaugust.com-20100603203237-5depiv08hjm5zxwx
Merged with build.

Show diffs side-by-side

added added

removed removed

Lines of Context:
99
99
 * @param c 32-bit code point
100
100
 * @return 1..4, or 0 if c is a surrogate or not a Unicode code point
101
101
 */
102
 
template <class T>
103
 
int codepoint_length(T c)
 
102
static inline int codepoint_length(uint32_t c)
104
103
{
105
 
  return (static_cast<uint32_t>(c) <= 0x7f ? 1 :
106
 
          (static_cast<uint32_t>(c) <= 0x7ff ? 2 :
107
 
           (static_cast<uint32_t>(c) <= 0xd7ff ? 3 :
108
 
            (static_cast<uint32_t>(c) <= 0xdfff || c>0x10ffff ? 0 :
109
 
             (static_cast<uint32_t>(c) <= 0xffff ? 3 : 4)))));
 
104
  return (c <= 0x7f ? 1 :
 
105
          (c <= 0x7ff ? 2 :
 
106
           (c <= 0xd7ff ? 3 :
 
107
            (c <= 0xdfff || c>0x10ffff ? 0 :
 
108
             (c <= 0xffff ? 3 : 4)))));
110
109
}
111
110
 
112
111
/**