<commit_before>/**
 * Utils
 *
 * Author: <NAME> (<EMAIL>)
 * Created on: 2014-10-20
 * Last Modified: 2014-10-23
 */

#ifndef UTILS_H
#define UTILS_H


#include <sys/time.h>

#include "common.h"

namespace util {

/**
 * Checks if the string is a numeric number
 * @param  str String to check
 * @return     True If the string represents a numeric number
 */
bool isNumeric(const char * str) {
  assert(str);
  while ((* str) != '\0') {
    if (!isdigit(* str)) {
        return false;
    } else {
        str++;
    }
  }
  return true;
}

/**
 * Get the hash code of any given number very quickly
 * @param  a The number to hash
 * @return   The hash code
 */
size_t hashCode(size_t a) {
      a ^= (a << 13);
      a ^= (a >> 17);
      a ^= (a << 5);
      return a;
}

/** Get current time in milliseconds */
double currentTimeMillis(void) {
    timeval t;
    gettimeofday(&t, NULL);
    double millis = static_cast<double> (t.tv_sec * 1000.0);
    millis += static_cast<double >(t.tv_usec / 1000.0);
    return millis;
}
<commit_msg>[Style] some blanks<commit_after>/**
 * Utils
 *
 * Author: <NAME> (<EMAIL>)
 * Created on: 2014-10-20
 * Last Modified: 2014-10-23
 */

#ifndef UTILS_H
#define UTILS_H


#include <sys/time.h>

#include "common.h"

namespace util {

/**
 * Checks if the string is a numeric number
 * @param  str String to check
 * @return     True If the string represents a numeric number
 */
 bool isNumeric(const char * str) {
    assert(str);
    while ((* str) != '\0') {
        if (!isdigit(* str)) {
            return false;
        } else {
            str++;
        }
    }
    return true;
}

/**
 * Get the hash code of any given number very quickly
 * @param  a The number to hash
 * @return   The hash code
 */
size_t hashCode(size_t a) {
    a ^= (a << 13);
    a ^= (a >> 17);
    a ^= (a << 5);
    return a;
}

/** Get current time in milliseconds */
double currentTimeMillis(void) {
    timeval t;
    gettimeofday(&t, NULL);
    double millis = static_cast<double> (t.tv_sec * 1000.0);
    millis += static_cast<double >(t.tv_usec / 1000.0);
    return millis;
}

{'fraction_non_alphanumeric': 0.1468498342018001, 'fraction_numerical': 0.030317385125532923, 'mean_word_length': 2.485148514851485, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 17, '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': '3346879', 'n_tokens_mistral': 814, 'n_tokens_neox': 748, 'n_words': 234}