Skip to content

Commit db24ba1

Browse files
committed
Use rustified enum for jit_code_t
1 parent 6095c18 commit db24ba1

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

build.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ fn main() {
7878
.whitelist_var("_?jit_.*")
7979
.whitelist_function("lgsys_.*")
8080
.whitelist_var("lgsys_.*")
81+
.rustified_non_exhaustive_enum("jit_code_t")
8182
.rustfmt_bindings(true)
8283
.clang_arg(format!("-I{}", incdir.to_str().unwrap()))
8384
.generate()

src/jitstate.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ macro_rules! jit_impl_inner {
8989
paste::item! {
9090
pub fn $op(&mut self $(, $arg: $type)*) -> JitNode<'a> {
9191
JitNode{
92-
node: unsafe { bindings::[< _jit_new_node_ $ifmt >](self.state, bindings::[< jit_code_t_jit_code_ $op >] $(, jit_impl_type!($arg.to_ffi() => $target))*) },
92+
node: unsafe { bindings::[< _jit_new_node_ $ifmt >](self.state, bindings::jit_code_t::[< jit_code_ $op >] $(, jit_impl_type!($arg.to_ffi() => $target))*) },
9393
phantom: std::marker::PhantomData,
9494
}
9595
}
@@ -140,7 +140,7 @@ macro_rules! jit_branch {
140140
paste::item! {
141141
pub fn $fn(&mut self, a: Reg, b: jit_imm!($t)) -> JitNode<'a> {
142142
JitNode{
143-
node: unsafe{ bindings::_jit_new_node_pww(self.state, bindings::[< jit_code_t_jit_code_ $fn >], null_mut::<c_void>(), a.to_ffi() as JitWord, b.to_ffi() as JitWord) },
143+
node: unsafe{ bindings::_jit_new_node_pww(self.state, bindings::jit_code_t::[< jit_code_ $fn >], null_mut::<c_void>(), a.to_ffi() as JitWord, b.to_ffi() as JitWord) },
144144
phantom: std::marker::PhantomData,
145145
}
146146
}
@@ -499,7 +499,7 @@ impl<'a> JitState<'a> {
499499
pub fn jmpi(&mut self) -> JitNode<'a> {
500500
// I looked at the lightning code, this will be copied
501501
JitNode{
502-
node: unsafe { bindings::_jit_new_node_p(self.state, bindings::jit_code_t_jit_code_jmpi, std::ptr::null_mut::<c_void >()) },
502+
node: unsafe { bindings::_jit_new_node_p(self.state, bindings::jit_code_t::jit_code_jmpi, std::ptr::null_mut::<c_void >()) },
503503
phantom: std::marker::PhantomData,
504504
}
505505
}

0 commit comments

Comments
 (0)