Skip to content

Hasher

hasher

Hasher

A helper class that accumulates hash values over time.

Source code in xdsl/utils/hasher.py
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
class Hasher:
    """
    A helper class that accumulates hash values over time.
    """

    hash: int

    def __init__(self, *, seed: int = 0):
        self.hash = seed

    def combine(self, other: Hashable) -> None:
        self.hash = hash((self.hash, other))

hash: int = seed instance-attribute

__init__(*, seed: int = 0)

Source code in xdsl/utils/hasher.py
11
12
def __init__(self, *, seed: int = 0):
    self.hash = seed

combine(other: Hashable) -> None

Source code in xdsl/utils/hasher.py
14
15
def combine(self, other: Hashable) -> None:
    self.hash = hash((self.hash, other))