代码拉取完成,页面将自动刷新
/*
* DERIVED FROM the stringencoders library's modp_numtoa
*
* Copyright ; 2007, Nick Galbreath -- nickg [at] client9 [dot] com
* All rights reserved.
* http://code.google.com/p/stringencoders/
* Released under the MIT license.
*
*/
#ifdef HAVE_CONFIG_H
#include "libevhtp-config.h" /* generated by config & autoconf */
#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
#include "internal.h"
#include "numtoa.h"
static inline void
strreverse(char * begin, char * end) {
char aux;
while (end > begin) {
aux = *end, *end-- = *begin, *begin++ = aux;
}
}
size_t
evhtp_modp_u64toa(uint64_t value, char * str) {
char * wstr = str;
/* Conversion. Number is reversed. */
do {
*wstr++ = (char)(48 + (value % 10));
} while (value /= 10);
*wstr = '\0';
/* Reverse string */
strreverse(str, wstr - 1);
return (size_t)(wstr - str);
}
size_t
evhtp_modp_u32toa(uint32_t value, char * str) {
char * wstr = str;
/* Conversion. Number is reversed. */
do {
*wstr++ = (char)(48 + (value % 10));
} while (value /= 10);
*wstr = '\0';
/* Reverse string */
strreverse(str, wstr - 1);
return (size_t)(wstr - str);
}
inline size_t
evhtp_modp_sizetoa(size_t value, char * str) {
#if TARGET_CPU == x86_64
return evhtp_modp_u64toa(value, str);
#elif TARGET_CPU == i686
return evhtp_modp_u32toa(value, str);
#elif TARGET_CPU == armv71
return evhtp_modp_u32toa(value, str);
#else
#warning "UNKNOWN ARCH"
#endif
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。