Fix build.
This commit is contained in:
parent
00b189d0c6
commit
e24848668a
@ -24,7 +24,7 @@ mod bit_field_functions {
|
|||||||
#[rhai_fn(return_raw)]
|
#[rhai_fn(return_raw)]
|
||||||
pub fn get_bit(value: INT, bit: INT) -> RhaiResultOf<bool> {
|
pub fn get_bit(value: INT, bit: INT) -> RhaiResultOf<bool> {
|
||||||
let bit = calc_index(BITS, bit, true, || {
|
let bit = calc_index(BITS, bit, true, || {
|
||||||
ERR::ErrorBitFieldBounds(BITS, bit, Position::NONE)
|
ERR::ErrorBitFieldBounds(BITS, bit, Position::NONE).into()
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
Ok((value & (1 << bit)) != 0)
|
Ok((value & (1 << bit)) != 0)
|
||||||
@ -32,7 +32,7 @@ mod bit_field_functions {
|
|||||||
#[rhai_fn(return_raw)]
|
#[rhai_fn(return_raw)]
|
||||||
pub fn set_bit(value: &mut INT, bit: INT, new_value: bool) -> RhaiResultOf<()> {
|
pub fn set_bit(value: &mut INT, bit: INT, new_value: bool) -> RhaiResultOf<()> {
|
||||||
let bit = calc_index(BITS, bit, true, || {
|
let bit = calc_index(BITS, bit, true, || {
|
||||||
ERR::ErrorBitFieldBounds(BITS, bit, Position::NONE)
|
ERR::ErrorBitFieldBounds(BITS, bit, Position::NONE).into()
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
let mask = 1 << bit;
|
let mask = 1 << bit;
|
||||||
@ -63,7 +63,7 @@ mod bit_field_functions {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let bit = calc_index(BITS, bit, true, || {
|
let bit = calc_index(BITS, bit, true, || {
|
||||||
ERR::ErrorBitFieldBounds(BITS, bit, Position::NONE)
|
ERR::ErrorBitFieldBounds(BITS, bit, Position::NONE).into()
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
let bits = if bit + bits as usize > BITS {
|
let bits = if bit + bits as usize > BITS {
|
||||||
@ -108,7 +108,7 @@ mod bit_field_functions {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let bit = calc_index(BITS, bit, true, || {
|
let bit = calc_index(BITS, bit, true, || {
|
||||||
ERR::ErrorBitFieldBounds(BITS, bit, Position::NONE)
|
ERR::ErrorBitFieldBounds(BITS, bit, Position::NONE).into()
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
let bits = if bit + bits as usize > BITS {
|
let bits = if bit + bits as usize > BITS {
|
||||||
|
@ -122,7 +122,7 @@ const BITS: usize = std::mem::size_of::<INT>() * 8;
|
|||||||
impl BitRange {
|
impl BitRange {
|
||||||
pub fn new(value: INT, from: INT, len: INT) -> RhaiResultOf<Self> {
|
pub fn new(value: INT, from: INT, len: INT) -> RhaiResultOf<Self> {
|
||||||
let from = calc_index(BITS, from, true, || {
|
let from = calc_index(BITS, from, true, || {
|
||||||
crate::ERR::ErrorBitFieldBounds(BITS, from, Position::NONE)
|
crate::ERR::ErrorBitFieldBounds(BITS, from, Position::NONE).into()
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
let len = if len < 0 {
|
let len = if len < 0 {
|
||||||
|
Loading…
Reference in New Issue
Block a user