def getBlob(self, offset): funcname = sys._getframe().f_code.co_name cache = caching.getCache(funcname) result = cache.get(offset) if result is not None: return result for i in self.streams["#Blob"].info: cache.put(*i.iteritems().next()) return cache.get(offset)
def decodeValue(self, value): funcname = sys._getframe().f_code.co_name cache = caching.getCache(funcname + "#" + self.hash) result = cache.get(value) if result is not None: return result bits = self.getBits(len(self.refs)) result = (self.refs[value & (1 << bits)-1], value >> bits) cache.put(value, result) return result
def dwordIndex(self): funcname = sys._getframe().f_code.co_name cache = caching.getCache(funcname) result = cache.get(self.hash) if result is not None: return result largestTable = max(self.dt.tables[_]["rows"] for _ in self.refs if _ != "Not used") result = self.getBits(largestTable) > 16 - self.getBits(len(self.refs)) cache.put(self.hash, result) return result
def decodeValue(self, value): funcname = sys._getframe().f_code.co_name cache = caching.getCache(funcname + "#" + self.hash) result = cache.get(value) if result is not None: return result bits = self.getBits(len(self.refs)) result = (self.refs[value & (1 << bits) - 1], value >> bits) cache.put(value, result) return result
def getBits(value): funcname = sys._getframe().f_code.co_name cache = caching.getCache(funcname) bits = cache.get(value) if bits is not None: return bits bits = 0 tmp = value - 1 while tmp > 0: bits += 1 tmp >>= 1 cache.put(value, bits) return bits