<commit_before>/*
  +----------------------------------------------------------------------+
  | See COPYING file for further copyright information                   |
  | This is a specialized hash map mapping uintprt_t to int32_t          |
  +----------------------------------------------------------------------+
  | Author: <NAME> <<EMAIL>>                     |
  | Modified by <NAME> for fixed size, removing unused functions    |
  | See CREDITS for contributors                                         |
  +----------------------------------------------------------------------+
*/

#ifdef PHP_WIN32
# include "ig_win32.h"
#endif

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include <assert.h>

#include "hash_ptr.h"
#include "zend.h"

/* Function similar to zend_inline_hash_func. This is not identical. */
inline uint32_t inline_hash_of_address(zend_uintptr_t ptr) {
	register uint32_t hash = Z_UL(5381);
	/* Note: Hash the least significant bytes first - Those need to influence the final result as much as possible. */
	hash = ((hash << 5) + hash) + (ptr & 0xff);
	hash = ((hash << 5) + hash) + ((ptr >> 8) & 0xff);
	hash = ((hash << 5) + hash) + ((ptr >> 16) & 0xff);
	hash = ((hash << 5) + hash) + ((ptr >> 24) & 0xff);
#if SIZEOF_ZEND_LONG == 8
	hash = ((hash << 5) + hash) + ((ptr >> 32) & 0xff);
	hash = ((hash << 5) + hash) + ((ptr >> 40) & 0xff);
	hash = ((hash << 5) + hash) + ((ptr >> 48) & 0xff);
	hash = ((hash << 5) + hash) + ((ptr >> 56) & 0xff);
#endif
	return hash;
}

/* {{{ nextpow2 */
/** Next power of 2.
 * @param n Integer.
 * @return next to n power of 2 .
 */
inline static uint32_t nextpow2(uint32_t n) {
	uint32_t m = 1;
	while (m < n) {
		m = m << 1;
	}

	return m;
}
/* }}} */
/* {{{ hash_si_ptr_init */
int hash_si_ptr_init(struct hash_si_ptr *h, size_t size) {<commit_msg>'inline' -> 'inline static' for clang?<commit_after>/*
  +----------------------------------------------------------------------+
  | See COPYING file for further copyright information                   |
  | This is a specialized hash map mapping uintprt_t to int32_t          |
  +----------------------------------------------------------------------+
  | Author: <NAME> <<EMAIL>>                     |
  | Modified by <NAME> for fixed size, removing unused functions    |
  | See CREDITS for contributors                                         |
  +----------------------------------------------------------------------+
*/

#ifdef PHP_WIN32
# include "ig_win32.h"
#endif

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include <assert.h>

#include "hash_ptr.h"
#include "zend.h"

/* Function similar to zend_inline_hash_func. This is not identical. */
inline static uint32_t inline_hash_of_address(zend_uintptr_t ptr) {
	register uint32_t hash = Z_UL(5381);
	/* Note: Hash the least significant bytes first - Those need to influence the final result as much as possible. */
	hash = ((hash << 5) + hash) + (ptr & 0xff);
	hash = ((hash << 5) + hash) + ((ptr >> 8) & 0xff);
	hash = ((hash << 5) + hash) + ((ptr >> 16) & 0xff);
	hash = ((hash << 5) + hash) + ((ptr >> 24) & 0xff);
#if SIZEOF_ZEND_LONG == 8
	hash = ((hash << 5) + hash) + ((ptr >> 32) & 0xff);
	hash = ((hash << 5) + hash) + ((ptr >> 40) & 0xff);
	hash = ((hash << 5) + hash) + ((ptr >> 48) & 0xff);
	hash = ((hash << 5) + hash) + ((ptr >> 56) & 0xff);
#endif
	return hash;
}

/* {{{ nextpow2 */
/** Next power of 2.
 * @param n Integer.
 * @return next to n power of 2 .
 */
inline static uint32_t nextpow2(uint32_t n) {
	uint32_t m = 1;
	while (m < n) {
		m = m << 1;
	}

	return m;
}
/* }}} */
/* {{{ hash_si_ptr_init */
int hash_si_ptr_init(struct hash_si_ptr *h, size_t size) {
{'fraction_non_alphanumeric': 0.2643398268398268, 'fraction_numerical': 0.030303030303030304, 'mean_word_length': 1.835122699386503, 'pattern_counts': {'":': 0, '<': 57, '<?xml version=': 0, '>': 48, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5644946', 'n_tokens_mistral': 1300, 'n_tokens_neox': 1189, 'n_words': 373}