(self, thing, size, byte_width)
:param thing:       The thing to convert to an AST
        :param size:        The size of the thing in bytes
        :param byte_width:  The size of a byte in bits
:param thing:       The thing to convert to an AST
        :param size:        The size of the thing in bytes
        :param byte_width:  The size of a byte in bits
: param thing : The thing to convert to an AST : param size : The size of the thing in bytes : param byte_width : The size of a byte in bits
def _convert_to_ast(self, thing, size, byte_width):
        """
        :param thing:       The thing to convert to an AST
        :param size:        The size of the thing in bytes
        :param byte_width:  The size of a byte in bits
        """
        if type(thing) is claripy.ast.BV:
            return thing

        if type(size) is int:
            bits = size * byte_width
        elif getattr(size, 'op', None) == 'BVV':
            bits = size.args[0] * byte_width
        else:
            bits = None

        if isinstance(thing, str):
            l.warning("Encoding unicode string for memory as utf-8. Did you mean to use a bytestring?")
            thing = thing.encode('utf-8')
        if type(thing) is bytes:
            return claripy.BVV(thing)
        elif type(thing) is int:
            if bits is None:
                l.warning("Unknown size for memory data %#x. Default to arch.bits.", thing)
                bits = self.state.arch.bits
            return claripy.BVV(thing, bits)
        elif type(thing) is float:
            if bits == 32:
                return claripy.FPV(thing, claripy.FSORT_FLOAT).raw_to_bv()
            elif bits == 64:
                return claripy.FPV(thing, claripy.FSORT_DOUBLE).raw_to_bv()
            else:
                raise TypeError("Passed float size which is not a float or a double", size)
        else:
            try:
                raw_to_bv = thing.raw_to_bv
            except AttributeError:
                raise TypeError("Bad value passed to memory", thing) from None
            else:
                return raw_to_bv()
def _convert_to_ast ( self , thing , size , byte_width ) : if type ( thing ) is claripy . ast . BV : return thing if type ( size ) is int : bits = size * byte_width elif getattr ( size , 'op' , None ) == 'BVV' : bits = size . args [ 0 ] * byte_width else : bits = None if isinstance ( thing , str ) : l . warning ( "Encoding unicode string for memory as utf-8. Did you mean to use a bytestring?" ) thing = thing . encode ( 'utf-8' ) if type ( thing ) is bytes : return claripy . BVV ( thing ) elif type ( thing ) is int : if bits is None : l . warning ( "Unknown size for memory data %#x. Default to arch.bits." , thing ) bits = self . state . arch . bits return claripy . BVV ( thing , bits ) elif type ( thing ) is float : if bits == 32 : return claripy . FPV ( thing , claripy . FSORT_FLOAT ) . raw_to_bv ( ) elif bits == 64 : return claripy . FPV ( thing , claripy . FSORT_DOUBLE ) . raw_to_bv ( ) else : raise TypeError ( "Passed float size which is not a float or a double" , size ) else : try : raw_to_bv = thing . raw_to_bv except AttributeError : raise TypeError ( "Bad value passed to memory" , thing ) from None else : return raw_to_bv ( )