<commit_before>/*
 @ <NAME>
*/

#if defined(_MSC_VER)
#pragma once
#endif

#ifndef MEMORY_BIN_H_
#define MEMORY_BIN_H_

#include <cstdint>

#include "compiler_helper.h"

template<size_t Granularity>
struct SlotTraits {
    enum { granularity = Granularity };
    uint8_t s[Granularity];
};

// Using 4K for a slot by default.
using DefaultSlotTraits = SlotTraits<4096>;

template<typename SlotTraitsType = DefaultSlotTraits>
class MemoryBin {
private:
    using Slot = SlotTraitsType;

public:
    MemoryBin(size_t slot_count) {};

    MemoryBin(const MemoryBin&) = delete;

    MemoryBin(MemoryBin&& other);

    MemoryBin& operator=(const MemoryBin&) = delete;

    MemoryBin& operator=(MemoryBin&& rhs);

    ~MemoryBin() = default;

    size_t slot_granularity() const
    {
        return Slot::granularity;
    }

private:
    FRIEND_TEST_WITH_PREFIX(MemoryBin);
};

#endif  // MEMORY_BIN_H_<commit_msg>temporary save. continue when I am back to home.<commit_after>/*
 @ <NAME>
*/

#if defined(_MSC_VER)
#pragma once
#endif

#ifndef MEMORY_BIN_H_
#define MEMORY_BIN_H_

#include <cstdint>
#include <memory>

#include "compiler_helper.h"

template<typename BlockType, size_t Granularity>
struct SlotTraits {
    enum {
        granularity = Granularity,
        block_count = granularity / sizeof(BlockType)
    };

    BlockType s[block_count];
};

// Using 4K for a slot by default.
using DefaultSlotTraits = SlotTraits<uint8_t, 4096>;

template<typename SlotTraitsType = DefaultSlotTraits>
class MemoryBin {
private:
    using Slot = SlotTraitsType;

public:
    MemoryBin(size_t slot_count)
        : slots_(std::make_unique<Slot[]>(slot_count))
    {}

    MemoryBin(const MemoryBin&) = delete;

    MemoryBin(MemoryBin&& other);

    MemoryBin& operator=(const MemoryBin&) = delete;

    MemoryBin& operator=(MemoryBin&& rhs);

    ~MemoryBin() = default;

    Slot* Map(size_t index);

    size_t slot_granularity() const
    {
        return Slot::granularity;
    }

private:
    FRIEND_TEST_WITH_PREFIX(MemoryBin);

private:
    std::unique_ptr<Slot[]> slots_;
};

#endif  // MEMORY_BIN_H_
{'fraction_non_alphanumeric': 0.11216730038022814, 'fraction_numerical': 0.005703422053231939, 'mean_word_length': 4.0, 'pattern_counts': {'":': 0, '<': 16, '<?xml version=': 0, '>': 16, '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': '4355004', 'n_tokens_mistral': 765, 'n_tokens_neox': 728, 'n_words': 160}