LLZK 2.0.0
An open-source IR for Zero Knowledge (ZK) circuits
Loading...
Searching...
No Matches
Hash.h
Go to the documentation of this file.
1//===-- Hash.h - Operation Hashing Utilities --------------------*- C++ -*-===//
2//
3// Part of the LLZK Project, under the Apache License v2.0.
4// See LICENSE.txt for license information.
5// Copyright 2025 Veridise Inc.
6// SPDX-License-Identifier: Apache-2.0
7//
8//===----------------------------------------------------------------------===//
9
10#pragma once
11
12#include <mlir/IR/Operation.h>
13
14#include <functional>
15
16namespace llzk {
17
18template <typename Op>
19concept OpHashable = requires(Op op) { op.getOperation(); };
20
21template <OpHashable Op> struct OpHash {
22 size_t operator()(const Op &op) const {
23 return std::hash<mlir::Operation *> {}(const_cast<Op &>(op).getOperation());
24 }
25};
26
27} // namespace llzk
size_t operator()(const Op &op) const
Definition Hash.h:22