(self, args, src_size, dst_size, src_signed, dst_signed)
return result
Generic pack with saturation.
        Split args in chunks of src_size and then pack them into saturated chunks of dst_size bits.
        Then chunks are concatenated.

        So far as I know plain saturating conversion should only ever have to be performed on vectors.
Generic pack with saturation.
        Split args in chunks of src_size and then pack them into saturated chunks of dst_size bits.
        Then chunks are concatenated.
Generic pack with saturation . Split args in chunks of src_size and then pack them into saturated chunks of dst_size bits . Then chunks are concatenated .
def _generic_pack_saturation(self, args, src_size, dst_size, src_signed, dst_signed):
        """
        Generic pack with saturation.
        Split args in chunks of src_size and then pack them into saturated chunks of dst_size bits.
        Then chunks are concatenated.

        So far as I know plain saturating conversion should only ever have to be performed on vectors.
        """
        if src_size <= 0 or dst_size <= 0:
            raise SimOperationError("Can't pack from or to zero or negative size: %s" % self.name)
        if src_size < dst_size:
            raise SimOperationError("Can't pack from small size into larger size: %s" % self.name)
        result = None

        max_value = 2**dst_size - 1
        if dst_signed:
            max_value >>= 1
        if not dst_signed or not src_signed:
            min_value = 0
        else:
            min_value = -2**(dst_size - 1)

        gt = claripy.SGT if src_signed else claripy.UGT
        lt = claripy.SLT if src_signed else claripy.ULT

        for v in args:
            for src_value in v.chop(src_size):
                dst_value = claripy.If(
                    gt(src_value, max_value), max_value, claripy.If(
                    lt(src_value, min_value), min_value, src_value[dst_size-1:0]))
                if result is None:
                    result = dst_value
                else:
                    result = self._op_concat((result, dst_value))
        return result
def _generic_pack_saturation ( self , args , src_size , dst_size , src_signed , dst_signed ) : if src_size <= 0 or dst_size <= 0 : raise SimOperationError ( "Can't pack from or to zero or negative size: %s" % self . name ) if src_size < dst_size : raise SimOperationError ( "Can't pack from small size into larger size: %s" % self . name ) result = None max_value = 2 ** dst_size - 1 if dst_signed : max_value >>= 1 if not dst_signed or not src_signed : min_value = 0 else : min_value = - 2 ** ( dst_size - 1 ) gt = claripy . SGT if src_signed else claripy . UGT lt = claripy . SLT if src_signed else claripy . ULT for v in args : for src_value in v . chop ( src_size ) : dst_value = claripy . If ( gt ( src_value , max_value ) , max_value , claripy . If ( lt ( src_value , min_value ) , min_value , src_value [ dst_size - 1 : 0 ] ) ) if result is None : result = dst_value else : result = self . _op_concat ( ( result , dst_value ) ) return result