<commit_before>#include <stdio.h>
#include <string.h>
#include "../include/macros.h"
#include "../include/stack.h"

struct generic_list_s *new_generic_list(int32_t initial)
{
  if(initial <= 0){
    log(F, "New generic list initial capacity must be greater than 0, %d given\n", initial);
    exit(1);
  }

  struct generic_list_s* l = alloc(struct generic_list_s, 1);
  l->start = 0;
  l->count = 0;
  l->capacity = initial;

  l->array = alloc(struct list_bucket*, initial);
  return l;
}

static void rebase_generic_list(list* l){
    if(l->start == 0){ return ; }
    struct list_bucket** tmp;
    printf("[%d] + %d of %d\n", l->start, l->count, l->capacity);

    int cpy = l->count - l->capacity + l->start;

    if(cpy > 0){
        tmp = alloc(struct list_bucket*, cpy)

        memcpy(tmp, l->array, sizeof(struct list_bucket*)*cpy);
    }
    else{ cpy = 0; }

    printf("mv %d + %d to 0\n", l->start, l->count - cpy);
    memcpy(l->array, l->array + l->start, sizeof(struct list_bucket*)*(l->count - cpy));

    if(cpy > 0){
        printf("mv + %d to %d\n", cpy, l->count - cpy);
        memcpy(l->array + l->count - cpy, tmp, sizeof(struct list_bucket*)*cpy);
        free(tmp);
    }<commit_msg>Added uint8_t generic_list_is_empty(struct generic_list_s* l){   return l->count == 0; }<commit_after>#include <stdio.h>
#include <string.h>
#include "../include/macros.h"
#include "../include/stack.h"

struct generic_list_s *new_generic_list(int32_t initial)
{
  if(initial <= 0){
    log(F, "New generic list initial capacity must be greater than 0, %d given\n", initial);
    exit(1);
  }

  struct generic_list_s* l = alloc(struct generic_list_s, 1);
  l->start = 0;
  l->count = 0;
  l->capacity = initial;

  l->array = alloc(struct list_bucket*, initial);
  return l;
}

uint8_t generic_list_is_empty(struct generic_list_s* l){
  return l->count == 0;
}

int32_t generic_list_get_count(struct generic_list_s* l){
  return l->count;
}

static void rebase_generic_list(list* l){
    if(l->start == 0){ return ; }
    struct list_bucket** tmp;
    printf("[%d] + %d of %d\n", l->start, l->count, l->capacity);

    int cpy = l->count - l->capacity + l->start;

    if(cpy > 0){
        tmp = alloc(struct list_bucket*, cpy)

        memcpy(tmp, l->array, sizeof(struct list_bucket*)*cpy);
    }
    else{ cpy = 0; }

    printf("mv %d + %d to 0\n", l->start, l->count - cpy);
    memcpy(l->array, l->array + l->start, sizeof(struct list_bucket*)*(l->count - cpy));

    if(cpy > 0){
        printf("mv + %d to %d\n", cpy, l->count - cpy);
        memcpy(l->array + l->count - cpy, tmp, sizeof(struct list_bucket*)*cpy);
        free(tmp);
    }
{'fraction_non_alphanumeric': 0.17914941663530298, 'fraction_numerical': 0.012043658261196839, 'mean_word_length': 3.15962441314554, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 56, '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': '7284133', 'n_tokens_mistral': 1020, 'n_tokens_neox': 979, 'n_words': 245}