Skip to content

Commit

Permalink
Formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
idavis committed Oct 19, 2023
1 parent 0316dde commit e84e5e3
Showing 1 changed file with 21 additions and 16 deletions.
37 changes: 21 additions & 16 deletions qirlib/src/values.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,11 @@ pub unsafe fn required_num_qubits(function: LLVMValueRef) -> Option<u64> {
)
})
.or_else(|| {
get_string_attribute(function, LLVMAttributeFunctionIndex, b"num_required_qubits")
get_string_attribute(
function,
LLVMAttributeFunctionIndex,
b"num_required_qubits",
)
})?;

let mut len = 0;
Expand All @@ -116,21 +120,22 @@ pub unsafe fn required_num_qubits(function: LLVMValueRef) -> Option<u64> {

pub unsafe fn required_num_results(function: LLVMValueRef) -> Option<u64> {
if LLVMGetValueKind(function) == LLVMValueKind::LLVMFunctionValueKind {
let required_results = get_string_attribute(
function,
LLVMAttributeFunctionIndex,
b"requiredResults",
)
.or_else(|| {
get_string_attribute(
function,
LLVMAttributeFunctionIndex,
b"required_num_results",
)
})
.or_else(|| {
get_string_attribute(function, LLVMAttributeFunctionIndex, b"num_required_results")
})?;
let required_results =
get_string_attribute(function, LLVMAttributeFunctionIndex, b"requiredResults")
.or_else(|| {
get_string_attribute(
function,
LLVMAttributeFunctionIndex,
b"required_num_results",
)
})
.or_else(|| {
get_string_attribute(
function,
LLVMAttributeFunctionIndex,
b"num_required_results",
)
})?;
let mut len = 0;
let value = LLVMGetStringAttributeValue(required_results.as_ptr(), &mut len);
let value = slice::from_raw_parts(value.cast(), len.try_into().unwrap());
Expand Down

0 comments on commit e84e5e3

Please sign in to comment.