def calculate_alloc_stats(self):
"""Calculates the minimum_size and alignment_gcd to determine "virtual allocs" when read lengths of data
It's particularly important to cast all numbers to ints, since they're used a lot and object take effort to reread.
"""
available_allocs = list(self.get_available_allocs())
self.minimum_size = int(min([size for _, size in available_allocs]))
accumulator = self.minimum_size
for start, _ in available_allocs:
if accumulator is None and start > 1:
accumulator = start
if accumulator and start > 0:
accumulator = fractions.gcd(accumulator, start)
self.alignment_gcd = int(accumulator)
# Pick an arbitrary cut-off that'll lead to too many reads
if self.alignment_gcd < 0x4:
debug.warning("Alignment of " + self.__class__.__name__ + " is too small, plugins will be extremely slow")
评论列表
文章目录