<commit_before>import struct
import string

def pack(*args):
	return _pack(args, '<I')


def pack64(*args):
	return _pack(args, '<Q')


def _pack(packlist, fmt='<I'):
	"""
	Pack a heterogeneous list of strings and integers.
	All integers will be packed according to the struct format.
	Returns all items concatinated as a string.
	
	'<I' : 32-bit little endian
	'<Q' : 64-bit little endian
	"""
	packed = ""
	for x in packlist:
		if type(x) == int:
			packed += struct.pack(fmt, x)
		else:
			packed += x
	return packed


def bits(data):<commit_msg>renamed pack/pack64 as rop/rop64 added packing of negative integers<commit_after>import struct
import string


def pack_int_64(num):
    return struct.pack('<Q', num) if (num > 0) else struct.pack('<q', num)

def pack_int_32(num):
    return struct.pack('<I', num) if (num > 0) else struct.pack('<i', num)



def rop(*args):
	"""
	Pack a heterogeneous list of strings and integers for ROP payload.
	Negative integers packed as signed values, and positive packed as signed. 
	"""
	packed = ""
	for x in args:
		if type(x) == int or type(x) == long:
			packed += pack_int_32(x)
		else:
			packed += x
	return packed


def rop64(*args):
	"""
	Pack a heterogeneous list of strings and integers for ROP payload.
	Negative integers packed as signed values, and positive packed as signed. 
	"""
	packed = ""
	for x in args:
		if type(x) == int or type(x) == long:
			packed += pack_int_64(x)
		else:
			packed += x
	return packed


def bits(data):
{'fraction_non_alphanumeric': 0.12424445936870383, 'fraction_numerical': 0.014775016789791807, 'mean_word_length': 3.7301587301587302, 'pattern_counts': {'":': 0, '<': 12, '<?xml version=': 0, '>': 5, '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': '5050410', 'n_tokens_mistral': 551, 'n_tokens_neox': 494, 'n_words': 187}