<commit_before>/*
 * byte_offset.cpp
 * 
 * An implementation of the byte_offset compression scheme used with CBF 
 * images with the hopeful intention of replacing existing Python code for 
 * doing this with something quicker. Main routines are: 
 *
 * vector<char> compress(vector<int>)
 * vector<int> uncompress(vector<char>)
 * 
 */ 

#include <iostream>
#include <vector>
#include <cstdlib>
#include <ctime>

using namespace std;

// unions to assist in byte manipulation

typedef union {
  char b[2];
  short s;
} u_s;

typedef union {
  char b[4];
  short i;
} u_i;

// functions for byte swapping

void byte_swap_short(char * b)
{
  char c;
  c = b[0];
  b[0] = b[1];
  b[1] = c;
  return;
}

void byte_swap_int(char * b)
{
  char c;
  c = b[0];
  b[0] = b[3];
  b[3] = c;
  c = b[1];
  b[1] = b[2];
  b[2] = c;
  return;
}<commit_msg>Broken union fixed (wny no warnings?)<commit_after>/*
 * byte_offset.cpp
 * 
 * An implementation of the byte_offset compression scheme used with CBF 
 * images with the hopeful intention of replacing existing Python code for 
 * doing this with something quicker. Main routines are: 
 *
 * vector<char> compress(vector<int>)
 * vector<int> uncompress(vector<char>)
 * 
 */ 

#include <iostream>
#include <vector>
#include <cstdlib>
#include <ctime>

using namespace std;

// unions to assist in byte manipulation

typedef union {
  char b[2];
  short s;
} u_s;

typedef union {
  char b[4];
  int i;
} u_i;

// functions for byte swapping

void byte_swap_short(char * b)
{
  char c;
  c = b[0];
  b[0] = b[1];
  b[1] = c;
  return;
}

void byte_swap_int(char * b)
{
  char c;
  c = b[0];
  b[0] = b[3];
  b[3] = c;
  c = b[1];
  b[1] = b[2];
  b[2] = c;
  return;
}
{'fraction_non_alphanumeric': 0.13976608187134504, 'fraction_numerical': 0.016374269005847954, 'mean_word_length': 3.298994974874372, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 19, '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': '4702909', 'n_tokens_mistral': 686, 'n_tokens_neox': 652, 'n_words': 205}