<commit_before>#include "../base/SRC_FIRST.hpp"
#include "hex.hpp"


namespace impl {
  static const char kToHexTable[] = "0123456789ABCDEF";

  void ToHexRaw(void const * src, size_t size, void * dst)
  {
    uint8_t const * ptr = static_cast<uint8_t const *>(src);
    uint8_t const * end = ptr + size;
    uint8_t * out = static_cast<uint8_t*>(dst);

    while (ptr != end)
    {
      *out++ = kToHexTable[(*ptr) >> 4];
      *out++ = kToHexTable[(*ptr) & 0xF];
      ++ptr;
    }
  }

//  static const char kFromHexTable[] = "0123456789ABCDEF";

  void FromHexRaw(void const * src, size_t size, void * dst)
  {
    uint8_t const * ptr = static_cast<uint8_t const *>(src);
    uint8_t const * end = ptr + size;
    uint8_t * out = static_cast<uint8_t*>(dst);

    while (ptr < end) {
      *out = 0;
      if (*ptr >= '0' && *ptr <= '9') {
        *out |= ((*ptr - '0') << 4);
      } else if (*ptr >= 'A' && *ptr <= 'F') {
        *out |= ((*ptr - 'A' + 10) << 4);
      }
      ++ptr;

      if (*ptr >= '0' && *ptr <= '9') {
        *out |= ((*ptr - '0') & 0xF);
      } else if (*ptr >= 'A' && *ptr <= 'F') {
        *out |= ((*ptr - 'A' + 10) & 0xF);
      }
      ++ptr;<commit_msg>Refactor and remove useless code in FromHex().<commit_after>#include "../base/SRC_FIRST.hpp"
#include "hex.hpp"


namespace impl {
  static const char kToHexTable[] = "0123456789ABCDEF";

  void ToHexRaw(void const * src, size_t size, void * dst)
  {
    uint8_t const * ptr = static_cast<uint8_t const *>(src);
    uint8_t const * end = ptr + size;
    uint8_t * out = static_cast<uint8_t*>(dst);

    while (ptr != end)
    {
      *out++ = kToHexTable[(*ptr) >> 4];
      *out++ = kToHexTable[(*ptr) & 0xF];
      ++ptr;
    }
  }

//  static const char kFromHexTable[] = "0123456789ABCDEF";

  uint8_t HexDigitToRaw(uint8_t const digit)
  {
    if (digit >= '0' && digit <= '9')
      return (digit - '0');
    else if (digit >= 'A' && digit <= 'F')
      return (digit - 'A' + 10);
    ASSERT(false, (digit));
    return 0;
  }

  void FromHexRaw(void const * src, size_t size, void * dst)
  {
    uint8_t const * ptr = static_cast<uint8_t const *>(src);
    uint8_t const * end = ptr + size;
    uint8_t * out = static_cast<uint8_t*>(dst);

    while (ptr < end)
    {
      *out = HexDigitToRaw(*ptr++) << 4;
      *out |= HexDigitToRaw(*ptr++);
{'fraction_non_alphanumeric': 0.18813993174061433, 'fraction_numerical': 0.03754266211604096, 'mean_word_length': 2.553030303030303, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3339946', 'n_tokens_mistral': 963, 'n_tokens_neox': 890, 'n_words': 226}