Skip to content

add Type::is_float() #37

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions gccjit_sys/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -553,6 +553,7 @@ extern {
pub fn gcc_jit_type_dyncast_array(typ: *mut gcc_jit_type) -> *mut gcc_jit_type;
pub fn gcc_jit_type_is_bool(typ: *mut gcc_jit_type) -> c_int;
pub fn gcc_jit_type_is_integral(typ: *mut gcc_jit_type) -> c_int;
pub fn gcc_jit_type_is_floating_point(typ: *mut gcc_jit_type) -> c_int;
pub fn gcc_jit_type_unqualified(typ: *mut gcc_jit_type) -> *mut gcc_jit_type;
pub fn gcc_jit_type_is_pointer(typ: *mut gcc_jit_type) -> *mut gcc_jit_type;
pub fn gcc_jit_type_dyncast_function_ptr_type(typ: *mut gcc_jit_type) -> *mut gcc_jit_function_type;
Expand Down
6 changes: 6 additions & 0 deletions src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,12 @@ impl<'ctx> Type<'ctx> {
}
}

pub fn is_floating_point(self) -> bool {
unsafe {
gccjit_sys::gcc_jit_type_is_floating_point(self.ptr) != 0
}
}

pub fn dyncast_vector(self) -> Option<VectorType<'ctx>> {
unsafe {
let vector_type = gccjit_sys::gcc_jit_type_dyncast_vector(self.ptr);
Expand Down
Loading