<commit_before><?php

/**
 * Common function
 *
 * @category	Eventing
 * @package		Common
 * @subpackage	BinaryParts
 * @see			/index.php
 */

	if (!defined('E_FRAMEWORK')) {
		headers_sent() || header('HTTP/1.1 404 Not Found', true, 404);
		exit('Direct script access is disallowed.');
	}

	if(!function_exists('binary_parts')) {
		/**
		 * Binary Parts
		 *
		 * Returns an array of integers. Each integer is a power of 2 that adds up
		 * to the number passed to the function.
		 *
		 * @access public
		 * @param integer $int
		 * @return array|false
		 */
		function binary_parts($int) {
			if(!is_int($int)
				|| (!is_numeric($int)
				|| !preg_match('|^[0-9]+$|', $int))
				|| $int < 0
			) {
				return false;
			}
			$arr = str_split(decbin((int) $int));
			$arr = array_reverse($arr);
			$count = count($arr);
			$parts = array();
			for($i = 0; $i < $count; $i++) {
				if($arr[$i] == '1') {
					$parts[] = pow(2, $i);
				}
			}
			return $parts;
		}
	}<commit_msg>Used a type cast to cut down on the dependancy checking at the beginning of the function.<commit_after><?php

/**
 * Common function
 *
 * @category	Eventing
 * @package		Common
 * @subpackage	BinaryParts
 * @see			/index.php
 */

	if (!defined('E_FRAMEWORK')) {
		headers_sent() || header('HTTP/1.1 404 Not Found', true, 404);
		exit('Direct script access is disallowed.');
	}

	if(!function_exists('binary_parts')) {
		/**
		 * Binary Parts
		 *
		 * Returns an array of integers. Each integer is a power of 2 that adds up
		 * to the number passed to the function.
		 *
		 * @access public
		 * @param integer $int
		 * @return array|false
		 */
		function binary_parts((int) $int) {
			if($int < 0) {
				return false;
			}
			$arr = str_split(decbin((int) $int));
			$arr = array_reverse($arr);
			$count = count($arr);
			$parts = array();
			for($i = 0; $i < $count; $i++) {
				if($arr[$i] == '1') {
					$parts[] = pow(2, $i);
				}
			}
			return $parts;
		}
	}
{'fraction_non_alphanumeric': 0.17631983598154793, 'fraction_numerical': 0.014351614556637622, 'mean_word_length': 2.8500986193293887, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 3, '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': '4023379', 'n_tokens_mistral': 825, 'n_tokens_neox': 678, 'n_words': 189}