Example #1
0
        def hash_iterate_next(self, w_dict, pos):
            from pycket.hash.persistent_hash_map import MASK_32
            storage = self.unerase(w_dict.hstorage)
            i = pos.value
            assert i >= 0
            index    = r_uint(i & MASK_32)
            subindex = r_uint((i >> 32) & MASK_32)

            bucket = get_dict_item(storage, index)[1]
            subindex += 1
            if subindex == r_uint(len(bucket)):
                subindex = r_uint(0)
                next = next_valid_index(
                        storage, intmask(index), valid=lambda x: bool(x[1]))
                index = r_uint(next)

            next = intmask((subindex << r_uint(32)) | index)
            return values.wrap(next)
Example #2
0
File: equal.py Project: rjnw/pycket
        def hash_iterate_next(self, w_dict, pos):
            from pycket.hash.persistent_hash_map import MASK_32
            storage = self.unerase(w_dict.hstorage)
            i = pos.value
            assert i >= 0
            index    = r_uint(i & MASK_32)
            subindex = r_uint((i >> 32) & MASK_32)

            bucket = get_dict_item(storage, index)[1]
            subindex += 1
            if subindex == r_uint(len(bucket)):
                subindex = r_uint(0)
                next = next_valid_index(
                        storage, intmask(index), valid=lambda x: bool(x[1]))
                index = r_uint(next)

            next = intmask((subindex << r_uint(32)) | index)
            return values.wrap(next)
Example #3
0
        def hash_iterate_next(self, w_dict, pos):
            from pycket.hash.persistent_hash_map import MASK_32
            storage = self.unerase(w_dict.hstorage)
            i = r_uint(pos.value)
            assert i >= 0
            index    = r_uint(i & MASK_32)
            subindex = r_uint((i >> 32) & MASK_32)

            bucket = get_dict_item(storage, index)[1]
            subindex += 1
            if subindex == r_uint(len(bucket)):
                subindex = r_uint(0)
                try:
                    next = next_valid_index(storage, intmask(index),
                                            valid=self._valid_bucket)
                except IndexError:
                    return values.w_false
                index = r_uint(next)

            next = intmask((subindex << r_uint(32)) | index)
            return values.wrap(next)
Example #4
0
        def hash_iterate_next(self, w_dict, pos):
            from pycket.hash.persistent_hash_map import MASK_32
            storage = self.unerase(w_dict.hstorage)
            i = r_uint(pos.value)
            assert i >= 0
            index    = r_uint(i & MASK_32)
            subindex = r_uint((i >> 32) & MASK_32)

            bucket = get_dict_item(storage, index)[1]
            subindex += 1
            if subindex == r_uint(len(bucket)):
                subindex = r_uint(0)
                try:
                    next = next_valid_index(storage, intmask(index),
                                            valid=self._valid_bucket)
                except IndexError:
                    return values.w_false
                index = r_uint(next)

            next = intmask((subindex << r_uint(32)) | index)
            return values.wrap(next)
Example #5
0
 def hash_iterate_first(self, w_dict):
     return next_valid_index(w_dict, 0, valid=self._valid_bucket)
Example #6
0
 def hash_iterate_first(self, w_dict):
     return next_valid_index(w_dict, 0, valid=lambda x: bool(x[1]))
Example #7
0
 def hash_iterate_first(self, w_dict):
     return next_valid_index(w_dict, 0, valid=self._valid_bucket)
Example #8
0
File: equal.py Project: rjnw/pycket
 def hash_iterate_first(self, w_dict):
     return next_valid_index(w_dict, 0, valid=lambda x: bool(x[1]))