/
zOMGdev
/
cppcms
Обзор
Документация
Войти
/
zOMGdev
/
cppcms
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
private/tohex.h
26 строк
906 B
Artyom Beilis
Moved common "tohex" functionality to centralized location
11 фев 2012, 16:02
11 фев 2012, 16:02
e62b429
Код
Авторство
О чём код?
/////////////////////////////////////////////////////////////////////////////// // // Copyright (C) 2008-2012 Artyom Beilis (Tonkikh) <artyomtnk@yahoo.com> // // See accompanying file COPYING.TXT file for licensing details. // /////////////////////////////////////////////////////////////////////////////// #ifndef CPPCMS_IMPL_TOHEX_H #define CPPCMS_IMPL_TOHEX_H namespace cppcms { namespace impl { inline void tohex(void const *vptr,size_t len,char *out) { unsigned char const *p=static_cast<unsigned char const *>(vptr); while(len>0) { static char const table[17]="0123456789abcdef"; unsigned char v=*p++; *out++ = table[(v >> 4) & 0xF]; *out++ = table[(v & 0xF)]; len--; } *out++ = '\0'; } } } #endif