| 1997 | } |
| 1998 | |
| 1999 | inline 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 | |
| 2016 | inline std::string from_i_to_hex(size_t n) { |
| 2017 | const char *charset = "0123456789abcdef"; |
no test coverage detected