code_to_mbc(OnigCodePoint code, UChar *buf)
{
  UChar *p = buf;

  if ((code & 0xff0000) != 0) *p++ = (UChar )(((code >> 16) & 0xff));
  if ((code &   0xff00) != 0) *p++ = (UChar )(((code >>  8) & 0xff));
  *p++ = (UChar )(code & 0xff);

#if 1
  if (enclen(ONIG_ENCODING_EUC_JP, buf) != (p - buf))
    return ONIGERR_INVALID_CODE_POINT_VALUE;
#endif  
  return p - buf;
}
code_to_mbc(OnigCodePoint code, UChar *buf)
{
  UChar *p = buf;

  if ((code & 0xff0000) != 0) *p++ = (UChar )(((code >> 16) & 0xff));
  if ((code &   0xff00) != 0) *p++ = (UChar )(((code >>  8) & 0xff));
  *p++ = (UChar )(code & 0xff);

#if 1
  if (enclen(ONIG_ENCODING_EUC_JP, buf) != (p - buf))
    return ONIGERR_INVALID_CODE_POINT_VALUE;
#endif  
  return p - buf;
}