<commit_before>def size_bits(t):
    '''Returns size, in BITS, of a type.'''
    for s in 256, 128, 64, 32, 16, 8, 1:
        if str(s) in t:
            return s
    raise Exception("Unable to determine length of %s." % t)

def size_bytes(t):
    '''Returns size, in BYTES, of a type.'''
    s = size_bits(t)
    if s == 1:
        raise Exception("size_bytes() is seeing a bit!")
    return s/8

def translate_irconst(state, c):
    size = size_bits(c.type)
    t = type(c.value)
    if t in (int, long):
        return state.se.BitVecVal(c.value, size)
    raise Exception("Unsupported constant type: %s" % type(c.value))

from .expressions import SimIRExpr, translate_expr
from .statements import SimIRStmt, translate_stmt
from .irsb import SimIRSB, SimIRSBError<commit_msg>Support lifting floats<commit_after>import claripy

def size_bits(t):
    '''Returns size, in BITS, of a type.'''
    for s in 256, 128, 64, 32, 16, 8, 1:
        if str(s) in t:
            return s
    raise SimExpressionError("Unable to determine length of %s." % t)

def size_bytes(t):
    '''Returns size, in BYTES, of a type.'''
    s = size_bits(t)
    if s == 1:
        raise SimExpressionError("size_bytes() is seeing a bit!")
    return s/8

def translate_irconst(state, c):
    size = size_bits(c.type)
    if isinstance(c.value, (int, long)):
        return state.se.BVV(c.value, size)
    elif isinstance(c.value, float):
        if size == 32:
            return state.se.FPV(c.value, claripy.FSORT_FLOAT)
        elif size == 64:
            return state.se.FPV(c.value, claripy.FSORT_DOUBLE)
        else:
            raise SimExpressionError("Unsupported floating point size: %d" % size)
    raise SimExpressionError("Unsupported constant type: %s" % type(c.value))

from .expressions import SimIRExpr, translate_expr
from .statements import SimIRStmt, translate_stmt
from .irsb import SimIRSB, SimIRSBError
from ..s_errors import SimExpressionError
{'fraction_non_alphanumeric': 0.1167095115681234, 'fraction_numerical': 0.018508997429305913, 'mean_word_length': 2.995893223819302, 'pattern_counts': {'":': 0, '<': 3, '<?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': '5796252', 'n_tokens_mistral': 678, 'n_tokens_neox': 641, 'n_words': 209}