-
Notifications
You must be signed in to change notification settings - Fork 37
Expand file tree
/
Copy pathlib.rs
More file actions
37 lines (31 loc) · 1.2 KB
/
lib.rs
File metadata and controls
37 lines (31 loc) · 1.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
//! This module provides the FFI API for the Expander Compiler, especially for the use of the Go language.
use expander_compiler::circuit::config::Config;
use libc::{c_uchar, c_ulong};
/// ABI version for the Expander Compiler.
/// The ABI version is used to ensure compatibility between different versions of the library.
const ABI_VERSION: c_ulong = 4;
#[macro_export]
macro_rules! match_config_id {
($config_id:ident, $inner:ident, $args:tt) => {
match $config_id {
x if x == M31Config::CONFIG_ID as u64 => $inner::<M31Config> $args,
x if x == BN254Config::CONFIG_ID as u64 => $inner::<BN254Config> $args,
x if x == GF2Config::CONFIG_ID as u64 => $inner::<GF2Config> $args,
x if x == GoldilocksConfig::CONFIG_ID as u64 => $inner::<GoldilocksConfig> $args,
_ => Err(format!("unknown config id: {}", $config_id)),
}
}
}
pub mod compile;
pub mod proving;
/// This struct represents a byte array used in the FFI API.
#[repr(C)]
pub struct ByteArray {
data: *mut c_uchar,
length: c_ulong,
}
/// This function returns the ABI version for the Expander Compiler.
#[no_mangle]
pub extern "C" fn abi_version() -> c_ulong {
ABI_VERSION
}