• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ conv_10函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中conv_10函数的典型用法代码示例。如果您正苦于以下问题:C++ conv_10函数的具体用法?C++ conv_10怎么用?C++ conv_10使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了conv_10函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: conv_10

void StringBuffer::append(int n) {
  char buf[12];
  int is_negative;
  int len;
  char *p = conv_10(n, &is_negative, buf + 12, &len);
  append(p, len);
}
开发者ID:kreshano,项目名称:hiphop-php,代码行数:7,代码来源:string_buffer.cpp


示例2: concat_is

/**
 * concat_is will incRef the output string
 */
StringData* concat_is(int64_t v1, StringData* v2) {
  char intbuf[21];
  // Convert the int to a string
  auto const s1 = conv_10(v1, intbuf + sizeof(intbuf));
  auto const s2 = v2->slice();
  return StringData::Make(s1, s2);
}
开发者ID:derickr,项目名称:hhvm,代码行数:10,代码来源:runtime.cpp


示例3: conv_10

static char *conv_apr_sockaddr(apr_sockaddr_t *sa, char *buf_end, int *len)
{
    char *p = buf_end;
    bool_int is_negative;
    int sub_len;
    char *ipaddr_str;

    p = conv_10(sa->port, TRUE, &is_negative, p, &sub_len);
    *--p = ':';
    apr_sockaddr_ip_get(&ipaddr_str, sa);
    sub_len = strlen(ipaddr_str);
#if APR_HAVE_IPV6
    if (sa->family == APR_INET6 &&
        !IN6_IS_ADDR_V4MAPPED(&sa->sa.sin6.sin6_addr)) {
        *(p - 1) = ']';
        p -= sub_len + 2;
        *p = '[';
        memcpy(p + 1, ipaddr_str, sub_len);
    }
    else
#endif
    {
        p -= sub_len;
        memcpy(p, ipaddr_str, sub_len);
    }

    *len = buf_end - p;
    return (p);
}
开发者ID:Garridon,项目名称:windowsrtdev,代码行数:29,代码来源:apr_snprintf.c


示例4: buildStringData

StringData* buildStringData(int64_t n) {
  char tmpbuf[21];

  tmpbuf[20] = '\0';
  auto const sl = conv_10(n, &tmpbuf[20]);
  return StringData::Make(sl, CopyString);
}
开发者ID:shantanusharma,项目名称:hhvm,代码行数:7,代码来源:type-string.cpp


示例5: concat_is

/**
 * concat_is will incRef the output string
 */
StringData* concat_is(int64_t v1, StringData* v2) {
  char intbuf[21];
  // Convert the int to a string
  auto const s1 = conv_10(v1, intbuf + sizeof(intbuf));
  StringSlice s2 = v2->slice();
  StringData* ret = StringData::Make(s1, s2);
  ret->incRefCount();
  return ret;
}
开发者ID:DmitrySoshnikov,项目名称:hhvm,代码行数:12,代码来源:runtime.cpp


示例6: equalAsStr

bool equalAsStr(int64 v1, litstr  v2) {
  char tmpbuf[21];
  char *p;
  int is_negative;
  int len;
  tmpbuf[20] = '\0';
  p = conv_10(v1, &is_negative, &tmpbuf[20], &len);
  return strcmp(p, v2) == 0;
}
开发者ID:prince-mishra,项目名称:hiphop-php,代码行数:9,代码来源:comparisons.cpp


示例7: return

static char *conv_10_quad(widest_int num, register bool_int is_unsigned,
                     register bool_int *is_negative, char *buf_end,
                     register int *len)
{
    register char *p = buf_end;
    u_widest_int magnitude;

    /*
     * We see if we can use the faster non-quad version by checking the
     * number against the largest long value it can be. If <=, we
     * punt to the quicker version.
     */
    if ((num <= ULONG_MAX && is_unsigned) 
        || (num <= LONG_MAX && num >= LONG_MIN && !is_unsigned))
            return(conv_10( (wide_int)num, is_unsigned, is_negative,
               buf_end, len));

    if (is_unsigned) {
        magnitude = (u_widest_int) num;
        *is_negative = FALSE;
    }
    else {
        *is_negative = (num < 0);

        /*
         * On a 2's complement machine, negating the most negative integer 
         * results in a number that cannot be represented as a signed integer.
         * Here is what we do to obtain the number's magnitude:
         *      a. add 1 to the number
         *      b. negate it (becomes positive)
         *      c. convert it to unsigned
         *      d. add 1
         */
        if (*is_negative) {
            widest_int t = num + 1;

            magnitude = ((u_widest_int) -t) + 1;
        }
        else
            magnitude = (u_widest_int) num;
    }

    /*
     * We use a do-while loop so that we write at least 1 digit 
     */
    do {
        u_widest_int new_magnitude = magnitude / 10;

        *--p = (char) (magnitude - new_magnitude * 10 + '0');
        magnitude = new_magnitude;
    }
    while (magnitude);

    *len = buf_end - p;
    return (p);
}
开发者ID:Garridon,项目名称:windowsrtdev,代码行数:56,代码来源:apr_snprintf.c


示例8: buildStringData

StringData* buildStringData(int64_t n) {
    char tmpbuf[21];
    char* p;
    int is_negative;
    int len;

    tmpbuf[20] = '\0';
    p = conv_10(n, &is_negative, &tmpbuf[20], &len);
    return StringData::Make(p, len, CopyString);
}
开发者ID:r2958,项目名称:hiphop-php,代码行数:10,代码来源:type-string.cpp


示例9: buildStringData

StringData* buildStringData(int n) {
  char tmpbuf[12];
  char* p;
  int is_negative;
  int len;

  tmpbuf[11] = '\0';
  p = conv_10(n, &is_negative, &tmpbuf[11], &len);
  return NEW(StringData)(p, len, CopyString);
}
开发者ID:silvajohnny,项目名称:hiphop-php,代码行数:10,代码来源:type_string.cpp


示例10: switch

static char *conv_os_thread_t(apr_os_thread_t *tid, char *buf_end, int *len)
{
    union {
        apr_os_thread_t tid;
        apr_uint64_t alignme;
    } u;
    int is_negative;

    u.tid = *tid;
    switch(sizeof(u.tid)) {
    case sizeof(apr_int32_t):
        return conv_10(*(apr_uint32_t *)&u.tid, TRUE, &is_negative, buf_end, len);
    case sizeof(apr_int64_t):
        return conv_10_quad(*(apr_uint64_t *)&u.tid, TRUE, &is_negative, buf_end, len);
    default:
        /* not implemented; stick 0 in the buffer */
        return conv_10(0, TRUE, &is_negative, buf_end, len);
    }
}
开发者ID:Garridon,项目名称:windowsrtdev,代码行数:19,代码来源:apr_snprintf.c


示例11: buildStringData

StringData* buildStringData(int n) {
  char tmpbuf[12];
  char* p;
  int is_negative;
  int len;

  TAINT_OBSERVER(TAINT_BIT_MUTATED, TAINT_BIT_NONE);

  tmpbuf[11] = '\0';
  p = conv_10(n, &is_negative, &tmpbuf[11], &len);
  return NEW(StringData)(p, len, CopyString);
}
开发者ID:AviMoto,项目名称:hiphop-php,代码行数:12,代码来源:type_string.cpp


示例12: conv_10

static char *conv_sockaddr_in(struct sockaddr_in *si, char *buf_end, int *len)
{
    char *p = buf_end;
    bool_int is_negative;
    int sub_len;

    p = conv_10(ntohs(si->sin_port), TRUE, &is_negative, p, &sub_len);
    *--p = ':';
    p = conv_in_addr(&si->sin_addr, p, &sub_len);

    *len = buf_end - p;
    return (p);
}
开发者ID:cmjonze,项目名称:anacapa,代码行数:13,代码来源:ap_printf.c


示例13: conv_10

String::String(int n) {
  char tmpbuf[12];
  char *p;
  int is_negative;
  int len;
  char *buf;

  tmpbuf[11] = '\0';
  p = conv_10(n, &is_negative, &tmpbuf[11], &len);

  buf = (char*)malloc(len + 1);
  memcpy(buf, p, len + 1); // including the null terminator.
  SmartPtr<StringData>::operator=(NEW(StringData)(buf, AttachString));
}
开发者ID:yigithub,项目名称:hiphop-php,代码行数:14,代码来源:type_string.cpp


示例14: conv_10

void StringBuffer::append(int64 n) {
  char buf[21];
  int is_negative;
  int len;
  const StringData *sd = String::GetIntegerStringData(n);
  char *p;
  if (!sd) {
    p = conv_10(n, &is_negative, buf + 21, &len);
  } else {
    p = (char *)sd->data();
    len = sd->size();
  }
  append(p, len);
}
开发者ID:AviMoto,项目名称:hiphop-php,代码行数:14,代码来源:string_buffer.cpp


示例15: conv_10

void StringBuffer::append(int64_t n) {
  char buf[21];
  int len;
  const StringData *sd = String::GetIntegerStringData(n);
  char *p;
  if (!sd) {
    auto sl = conv_10(n, buf + 21);
    p = const_cast<char*>(sl.ptr);
    len = sl.len;
  } else {
    p = (char *)sd->data();
    len = sd->size();
  }
  append(p, len);
}
开发者ID:nurulimamnotes,项目名称:hhvm,代码行数:15,代码来源:string-buffer.cpp


示例16: conv_10

void StringBuffer::append(int n) {
  char buf[12];
  int len;
  auto const sd = String::GetIntegerStringData(n);
  char *p;
  if (!sd) {
    auto sl = conv_10(n, buf + 12);
    p = const_cast<char*>(sl.data());
    len = sl.size();
  } else {
    p = (char *)sd->data();
    len = sd->size();
  }
  append(p, len);
}
开发者ID:mahanhaz,项目名称:hhvm,代码行数:15,代码来源:string-buffer.cpp


示例17: equalAsStr

bool equalAsStr(int64_t v1, litstr  v2) {
  char tmpbuf[21];
  char *p;
  int is_negative;
  int len;
  const StringData *sd = String::GetIntegerStringData(v1);
  if (sd) {
    p = (char *)sd->data();
    len = sd->size();
  } else {
    tmpbuf[20] = '\0';
    p = conv_10(v1, &is_negative, &tmpbuf[20], &len);
  }
  return strcmp(p, v2) == 0;
}
开发者ID:524777134,项目名称:hiphop-php,代码行数:15,代码来源:comparisons.cpp


示例18: TAINT_OBSERVER

String::String(int64 n) {
  char tmpbuf[21];
  char *p;
  int is_negative;
  int len;
  char *buf;

  TAINT_OBSERVER(TAINT_BIT_MUTATED, TAINT_BIT_NONE);

  tmpbuf[20] = '\0';
  p = conv_10(n, &is_negative, &tmpbuf[20], &len);

  buf = (char*)malloc(len + 1);
  memcpy(buf, p, len + 1); // including the null terminator.
  m_px = NEW(StringData)(buf, len, AttachString);
  m_px->setRefCount(1);
}
开发者ID:SimplProduction,项目名称:hiphop-php,代码行数:17,代码来源:type_string.cpp


示例19: ntohl

static char *conv_in_addr(struct in_addr *ia, char *buf_end, apr_size_t *len)
{
    unsigned addr = ntohl(ia->s_addr);
    char *p = buf_end;
    int is_negative;
    apr_size_t sub_len;

    p = conv_10((addr & 0x000000FF)      , TRUE, &is_negative, p, &sub_len);
    *--p = '.';
    p = conv_10((addr & 0x0000FF00) >>  8, TRUE, &is_negative, p, &sub_len);
    *--p = '.';
    p = conv_10((addr & 0x00FF0000) >> 16, TRUE, &is_negative, p, &sub_len);
    *--p = '.';
    p = conv_10((addr & 0xFF000000) >> 24, TRUE, &is_negative, p, &sub_len);

    *len = buf_end - p;
    return (p);
}
开发者ID:yinsen,项目名称:apache-text,代码行数:18,代码来源:apr_snprintf.c


示例20: concat_si

/**
 * concat_si will incRef the output string
 * and decref its first argument
 */
StringData* concat_si(StringData* v1, int64_t v2) {
  char intbuf[21];
  auto const s2 = conv_10(v2, intbuf + sizeof(intbuf));
  if (v1->cowCheck()) {
    auto const s1 = v1->slice();
    auto const ret = StringData::Make(s1, s2);
    // Because v1 was shared, we know this won't release it.
    v1->decRefCount();
    return ret;
  }

  auto const ret = v1->append(s2);
  if (UNLIKELY(ret != v1)) {
    assert(v1->hasExactlyOneRef());
    v1->release();
  }
  return ret;
}
开发者ID:derickr,项目名称:hhvm,代码行数:22,代码来源:runtime.cpp



注:本文中的conv_10函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ conversation_add_proto_data函数代码示例发布时间:2022-05-30
下一篇:
C++ convM2D函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap