<commit_before>#ifndef __CRYPTO_COMMON_HH
#define __CRYPTO_COMMON_HH

#include <cstdint>
#include <cstring>
#include <memory>
#include <string>

namespace crypto {

/**
 * A generic structure to represent a pointer to a bounded segment in the
 * memory without any assertions on the ownership of that segment.
 *
 * The class has two accessors: ptr() and cptr().  First returns a read-write
 * pointer, second returns read-only pointer, and it's the only one you can use
 * if you have a const memslice.  To create a const memslice, use cmem()
 * function.
 *
 * By convention, a null memory slice is represented as {nullptr, 0},
 * which is normally referred to as nullmem.
 */
struct memslice {
  private:
    uint8_t *ptr_;
    size_t size_;

  public:
    inline memslice(uint8_t *ptr, size_t size)
        : ptr_(ptr), size_(size) {}
    operator bool() { return ptr_ != nullptr; }<commit_msg>Mark operator bool() as explicit<commit_after>#ifndef __CRYPTO_COMMON_HH
#define __CRYPTO_COMMON_HH

#include <cstdint>
#include <cstring>
#include <memory>
#include <string>

namespace crypto {

/**
 * A generic structure to represent a pointer to a bounded segment in the
 * memory without any assertions on the ownership of that segment.
 *
 * The class has two accessors: ptr() and cptr().  First returns a read-write
 * pointer, second returns read-only pointer, and it's the only one you can use
 * if you have a const memslice.  To create a const memslice, use cmem()
 * function.
 *
 * By convention, a null memory slice is represented as {nullptr, 0},
 * which is normally referred to as nullmem.
 */
struct memslice {
  private:
    uint8_t *ptr_;
    size_t size_;

  public:
    inline memslice(uint8_t *ptr, size_t size)
        : ptr_(ptr), size_(size) {}
    inline explicit operator bool() { return ptr_ != nullptr; }
{'fraction_non_alphanumeric': 0.08956854178044785, 'fraction_numerical': 0.0032768978700163844, 'mean_word_length': 3.8337730870712403, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, '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': '2798523', 'n_tokens_mistral': 554, 'n_tokens_neox': 543, 'n_words': 234}