<commit_before>/* velox: velox/vector.h
 *
 * Copyright (c) 2010 <NAME> <<EMAIL>>
 *
 * This file is a part of velox.
 *
 * velox is free software; you can redistribute it and/or modify it under the
 * terms of the GNU General Public License version 2, as published by the Free
 * Software Foundation.
 *
 * velox is distributed in the hope that it will be useful, but WITHOUT ANY
 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
 * details.
 *
 * You should have received a copy of the GNU General Public License along
 * with velox.  If not, see <http://www.gnu.org/licenses/>.
 */

#ifndef VELOX_VECTOR
#define VELOX_VECTOR

#include <stdint.h>
#include <stdbool.h>

#define DEFINE_VECTOR(type, data_type)                                      \
    struct type                                                             \
    {                                                                       \
        data_type * data;                                                   \
        uint32_t size;                                                      \
        uint32_t capacity;                                                  \
    }

#define VECTOR_INIT() { NULL, 0, 0 }                                        \

#define VECTOR(type, name)                                                  \
    struct type name = VECTOR_INIT()

static uint32_t next_power_of_two(uint32_t n)
{
    uint8_t bit;

    --n;
    for (bit = 1; bit < 32; bit <<= 1, n |= n >> bit);

    return ++n;
}

/**
 * Initialize a new vector with the specified capacity
 *
 * @param capacity The capacity of the new vector. This will be rounded up to
 * the next power of two
 */<commit_msg>Not using these<commit_after>/* velox: velox/vector.h
 *
 * Copyright (c) 2010 <NAME> <<EMAIL>>
 *
 * This file is a part of velox.
 *
 * velox is free software; you can redistribute it and/or modify it under the
 * terms of the GNU General Public License version 2, as published by the Free
 * Software Foundation.
 *
 * velox is distributed in the hope that it will be useful, but WITHOUT ANY
 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
 * details.
 *
 * You should have received a copy of the GNU General Public License along
 * with velox.  If not, see <http://www.gnu.org/licenses/>.
 */

#ifndef VELOX_VECTOR
#define VELOX_VECTOR

#include <stdint.h>
#include <stdbool.h>

#define DEFINE_VECTOR(type, data_type)                                      \
    struct type                                                             \
    {                                                                       \
        data_type * data;                                                   \
        uint32_t size;                                                      \
        uint32_t capacity;                                                  \
    }

static inline uint32_t next_power_of_two(uint32_t n)
{
    uint8_t bit;

    --n;
    for (bit = 1; bit < 32; bit <<= 1, n |= n >> bit);

    return ++n;
}

/**
 * Initialize a new vector with the specified capacity
 *
 * @param capacity The capacity of the new vector. This will be rounded up to
 * the next power of two
 */
{'fraction_non_alphanumeric': 0.07504466944609887, 'fraction_numerical': 0.011316259678379988, 'mean_word_length': 1.4217736121124729, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 28, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2171582', 'n_tokens_mistral': 867, 'n_tokens_neox': 832, 'n_words': 345}