MCPcopy Create free account
hub / github.com/Tiiny-AI/PowerInfer / from_hex_to_i

Function from_hex_to_i

examples/server/httplib.h:1999–2014  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1997}
1998
1999inline bool from_hex_to_i(const std::string &s, size_t i, size_t cnt,
2000 int &val) {
2001 if (i >= s.size()) { return false; }
2002
2003 val = 0;
2004 for (; cnt; i++, cnt--) {
2005 if (!s[i]) { return false; }
2006 int v = 0;
2007 if (is_hex(s[i], v)) {
2008 val = val * 16 + v;
2009 } else {
2010 return false;
2011 }
2012 }
2013 return true;
2014}
2015
2016inline std::string from_i_to_hex(size_t n) {
2017 const char *charset = "0123456789abcdef";

Callers 1

decode_urlFunction · 0.85

Calls 2

is_hexFunction · 0.85
sizeMethod · 0.45

Tested by

no test coverage detected