mirror of
https://github.com/cccb/servicepoint.git
synced 2025-01-18 18:10:14 +01:00
rename sp_bit_vec_* to sp_bitvec_*
This commit is contained in:
parent
a08d439366
commit
fbc8cd6c31
4
Cargo.lock
generated
4
Cargo.lock
generated
|
@ -147,9 +147,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cc"
|
name = "cc"
|
||||||
version = "1.1.29"
|
version = "1.1.30"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "58e804ac3194a48bb129643eb1d62fcc20d18c6b8c181704489353d13120bcd1"
|
checksum = "b16803a61b81d9eabb7eae2588776c4c1e584b738ede45fdbb4c972cec1e9945"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"jobserver",
|
"jobserver",
|
||||||
"libc",
|
"libc",
|
||||||
|
|
|
@ -25,7 +25,7 @@ fn main() {
|
||||||
let connection = Connection::open(cli.destination)
|
let connection = Connection::open(cli.destination)
|
||||||
.expect("could not connect to display");
|
.expect("could not connect to display");
|
||||||
|
|
||||||
let mut enabled_pixels = Bitmap::new(PIXEL_WIDTH, PIXEL_HEIGHT);
|
let mut enabled_pixels = Bitmap::max_sized();
|
||||||
enabled_pixels.fill(true);
|
enabled_pixels.fill(true);
|
||||||
|
|
||||||
for x_offset in 0..PIXEL_WIDTH {
|
for x_offset in 0..PIXEL_WIDTH {
|
||||||
|
|
|
@ -76,9 +76,9 @@ typedef uint16_t SPCompressionCode;
|
||||||
*
|
*
|
||||||
* # Examples
|
* # Examples
|
||||||
* ```C
|
* ```C
|
||||||
* SPBitVec vec = sp_bit_vec_new(8);
|
* SPBitVec vec = sp_bitvec_new(8);
|
||||||
* sp_bit_vec_set(vec, 5, true);
|
* sp_bitvec_set(vec, 5, true);
|
||||||
* sp_bit_vec_free(vec);
|
* sp_bitvec_free(vec);
|
||||||
* ```
|
* ```
|
||||||
*/
|
*/
|
||||||
typedef struct SPBitVec SPBitVec;
|
typedef struct SPBitVec SPBitVec;
|
||||||
|
@ -212,9 +212,9 @@ extern "C" {
|
||||||
* - `bit_vec` points to a valid [SPBitVec]
|
* - `bit_vec` points to a valid [SPBitVec]
|
||||||
* - `bit_vec` is not written to concurrently
|
* - `bit_vec` is not written to concurrently
|
||||||
* - the returned instance is freed in some way, either by using a consuming function or
|
* - the returned instance is freed in some way, either by using a consuming function or
|
||||||
* by explicitly calling `sp_bit_vec_free`.
|
* by explicitly calling `sp_bitvec_free`.
|
||||||
*/
|
*/
|
||||||
struct SPBitVec *sp_bit_vec_clone(const struct SPBitVec *bit_vec);
|
struct SPBitVec *sp_bitvec_clone(const struct SPBitVec *bit_vec);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the value of all bits in the [SPBitVec].
|
* Sets the value of all bits in the [SPBitVec].
|
||||||
|
@ -235,7 +235,7 @@ struct SPBitVec *sp_bit_vec_clone(const struct SPBitVec *bit_vec);
|
||||||
* - `bit_vec` points to a valid [SPBitVec]
|
* - `bit_vec` points to a valid [SPBitVec]
|
||||||
* - `bit_vec` is not written to or read from concurrently
|
* - `bit_vec` is not written to or read from concurrently
|
||||||
*/
|
*/
|
||||||
void sp_bit_vec_fill(struct SPBitVec *bit_vec, bool value);
|
void sp_bitvec_fill(struct SPBitVec *bit_vec, bool value);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Deallocates a [SPBitVec].
|
* Deallocates a [SPBitVec].
|
||||||
|
@ -252,7 +252,7 @@ void sp_bit_vec_fill(struct SPBitVec *bit_vec, bool value);
|
||||||
* - `bit_vec` is not used concurrently or after this call
|
* - `bit_vec` is not used concurrently or after this call
|
||||||
* - `bit_vec` was not passed to another consuming function, e.g. to create a [SPCommand]
|
* - `bit_vec` was not passed to another consuming function, e.g. to create a [SPCommand]
|
||||||
*/
|
*/
|
||||||
void sp_bit_vec_free(struct SPBitVec *bit_vec);
|
void sp_bitvec_free(struct SPBitVec *bit_vec);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the value of a bit from the [SPBitVec].
|
* Gets the value of a bit from the [SPBitVec].
|
||||||
|
@ -276,7 +276,7 @@ void sp_bit_vec_free(struct SPBitVec *bit_vec);
|
||||||
* - `bit_vec` points to a valid [SPBitVec]
|
* - `bit_vec` points to a valid [SPBitVec]
|
||||||
* - `bit_vec` is not written to concurrently
|
* - `bit_vec` is not written to concurrently
|
||||||
*/
|
*/
|
||||||
bool sp_bit_vec_get(const struct SPBitVec *bit_vec, size_t index);
|
bool sp_bitvec_get(const struct SPBitVec *bit_vec, size_t index);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if length is 0.
|
* Returns true if length is 0.
|
||||||
|
@ -295,7 +295,7 @@ bool sp_bit_vec_get(const struct SPBitVec *bit_vec, size_t index);
|
||||||
*
|
*
|
||||||
* - `bit_vec` points to a valid [SPBitVec]
|
* - `bit_vec` points to a valid [SPBitVec]
|
||||||
*/
|
*/
|
||||||
bool sp_bit_vec_is_empty(const struct SPBitVec *bit_vec);
|
bool sp_bitvec_is_empty(const struct SPBitVec *bit_vec);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the length of the [SPBitVec] in bits.
|
* Gets the length of the [SPBitVec] in bits.
|
||||||
|
@ -314,7 +314,7 @@ bool sp_bit_vec_is_empty(const struct SPBitVec *bit_vec);
|
||||||
*
|
*
|
||||||
* - `bit_vec` points to a valid [SPBitVec]
|
* - `bit_vec` points to a valid [SPBitVec]
|
||||||
*/
|
*/
|
||||||
size_t sp_bit_vec_len(const struct SPBitVec *bit_vec);
|
size_t sp_bitvec_len(const struct SPBitVec *bit_vec);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Interpret the data as a series of bits and load then into a new [SPBitVec] instance.
|
* Interpret the data as a series of bits and load then into a new [SPBitVec] instance.
|
||||||
|
@ -332,9 +332,9 @@ size_t sp_bit_vec_len(const struct SPBitVec *bit_vec);
|
||||||
* - `data` points to a valid memory location of at least `data_length`
|
* - `data` points to a valid memory location of at least `data_length`
|
||||||
* bytes in size.
|
* bytes in size.
|
||||||
* - the returned instance is freed in some way, either by using a consuming function or
|
* - the returned instance is freed in some way, either by using a consuming function or
|
||||||
* by explicitly calling `sp_bit_vec_free`.
|
* by explicitly calling `sp_bitvec_free`.
|
||||||
*/
|
*/
|
||||||
struct SPBitVec *sp_bit_vec_load(const uint8_t *data,
|
struct SPBitVec *sp_bitvec_load(const uint8_t *data,
|
||||||
size_t data_length);
|
size_t data_length);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -355,9 +355,9 @@ struct SPBitVec *sp_bit_vec_load(const uint8_t *data,
|
||||||
* The caller has to make sure that:
|
* The caller has to make sure that:
|
||||||
*
|
*
|
||||||
* - the returned instance is freed in some way, either by using a consuming function or
|
* - the returned instance is freed in some way, either by using a consuming function or
|
||||||
* by explicitly calling `sp_bit_vec_free`.
|
* by explicitly calling `sp_bitvec_free`.
|
||||||
*/
|
*/
|
||||||
struct SPBitVec *sp_bit_vec_new(size_t size);
|
struct SPBitVec *sp_bitvec_new(size_t size);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the value of a bit in the [SPBitVec].
|
* Sets the value of a bit in the [SPBitVec].
|
||||||
|
@ -380,7 +380,7 @@ struct SPBitVec *sp_bit_vec_new(size_t size);
|
||||||
* - `bit_vec` points to a valid [SPBitVec]
|
* - `bit_vec` points to a valid [SPBitVec]
|
||||||
* - `bit_vec` is not written to or read from concurrently
|
* - `bit_vec` is not written to or read from concurrently
|
||||||
*/
|
*/
|
||||||
void sp_bit_vec_set(struct SPBitVec *bit_vec, size_t index, bool value);
|
void sp_bitvec_set(struct SPBitVec *bit_vec, size_t index, bool value);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets an unsafe reference to the data of the [SPBitVec] instance.
|
* Gets an unsafe reference to the data of the [SPBitVec] instance.
|
||||||
|
@ -401,7 +401,7 @@ void sp_bit_vec_set(struct SPBitVec *bit_vec, size_t index, bool value);
|
||||||
* - the returned memory range is never accessed after the passed [SPBitVec] has been freed
|
* - the returned memory range is never accessed after the passed [SPBitVec] has been freed
|
||||||
* - the returned memory range is never accessed concurrently, either via the [SPBitVec] or directly
|
* - the returned memory range is never accessed concurrently, either via the [SPBitVec] or directly
|
||||||
*/
|
*/
|
||||||
struct SPByteSlice sp_bit_vec_unsafe_data_ref(struct SPBitVec *bit_vec);
|
struct SPByteSlice sp_bitvec_unsafe_data_ref(struct SPBitVec *bit_vec);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clones a [SPBitmap].
|
* Clones a [SPBitmap].
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
//! C functions for interacting with [SPBitVec]s
|
//! C functions for interacting with [SPBitVec]s
|
||||||
//!
|
//!
|
||||||
//! prefix `sp_bit_vec_`
|
//! prefix `sp_bitvec_`
|
||||||
|
|
||||||
use crate::SPByteSlice;
|
use crate::SPByteSlice;
|
||||||
use servicepoint::bitvec::prelude::{BitVec, Msb0};
|
use servicepoint::bitvec::prelude::{BitVec, Msb0};
|
||||||
|
@ -9,9 +9,9 @@ use servicepoint::bitvec::prelude::{BitVec, Msb0};
|
||||||
///
|
///
|
||||||
/// # Examples
|
/// # Examples
|
||||||
/// ```C
|
/// ```C
|
||||||
/// SPBitVec vec = sp_bit_vec_new(8);
|
/// SPBitVec vec = sp_bitvec_new(8);
|
||||||
/// sp_bit_vec_set(vec, 5, true);
|
/// sp_bitvec_set(vec, 5, true);
|
||||||
/// sp_bit_vec_free(vec);
|
/// sp_bitvec_free(vec);
|
||||||
/// ```
|
/// ```
|
||||||
pub struct SPBitVec(BitVec<u8, Msb0>);
|
pub struct SPBitVec(BitVec<u8, Msb0>);
|
||||||
|
|
||||||
|
@ -50,9 +50,9 @@ impl Clone for SPBitVec {
|
||||||
/// The caller has to make sure that:
|
/// The caller has to make sure that:
|
||||||
///
|
///
|
||||||
/// - the returned instance is freed in some way, either by using a consuming function or
|
/// - the returned instance is freed in some way, either by using a consuming function or
|
||||||
/// by explicitly calling `sp_bit_vec_free`.
|
/// by explicitly calling `sp_bitvec_free`.
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub unsafe extern "C" fn sp_bit_vec_new(size: usize) -> *mut SPBitVec {
|
pub unsafe extern "C" fn sp_bitvec_new(size: usize) -> *mut SPBitVec {
|
||||||
let result = Box::into_raw(Box::new(SPBitVec(BitVec::repeat(false, size))));
|
let result = Box::into_raw(Box::new(SPBitVec(BitVec::repeat(false, size))));
|
||||||
assert!(!result.is_null());
|
assert!(!result.is_null());
|
||||||
result
|
result
|
||||||
|
@ -73,9 +73,9 @@ pub unsafe extern "C" fn sp_bit_vec_new(size: usize) -> *mut SPBitVec {
|
||||||
/// - `data` points to a valid memory location of at least `data_length`
|
/// - `data` points to a valid memory location of at least `data_length`
|
||||||
/// bytes in size.
|
/// bytes in size.
|
||||||
/// - the returned instance is freed in some way, either by using a consuming function or
|
/// - the returned instance is freed in some way, either by using a consuming function or
|
||||||
/// by explicitly calling `sp_bit_vec_free`.
|
/// by explicitly calling `sp_bitvec_free`.
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub unsafe extern "C" fn sp_bit_vec_load(
|
pub unsafe extern "C" fn sp_bitvec_load(
|
||||||
data: *const u8,
|
data: *const u8,
|
||||||
data_length: usize,
|
data_length: usize,
|
||||||
) -> *mut SPBitVec {
|
) -> *mut SPBitVec {
|
||||||
|
@ -101,9 +101,9 @@ pub unsafe extern "C" fn sp_bit_vec_load(
|
||||||
/// - `bit_vec` points to a valid [SPBitVec]
|
/// - `bit_vec` points to a valid [SPBitVec]
|
||||||
/// - `bit_vec` is not written to concurrently
|
/// - `bit_vec` is not written to concurrently
|
||||||
/// - the returned instance is freed in some way, either by using a consuming function or
|
/// - the returned instance is freed in some way, either by using a consuming function or
|
||||||
/// by explicitly calling `sp_bit_vec_free`.
|
/// by explicitly calling `sp_bitvec_free`.
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub unsafe extern "C" fn sp_bit_vec_clone(
|
pub unsafe extern "C" fn sp_bitvec_clone(
|
||||||
bit_vec: *const SPBitVec,
|
bit_vec: *const SPBitVec,
|
||||||
) -> *mut SPBitVec {
|
) -> *mut SPBitVec {
|
||||||
assert!(!bit_vec.is_null());
|
assert!(!bit_vec.is_null());
|
||||||
|
@ -126,7 +126,7 @@ pub unsafe extern "C" fn sp_bit_vec_clone(
|
||||||
/// - `bit_vec` is not used concurrently or after this call
|
/// - `bit_vec` is not used concurrently or after this call
|
||||||
/// - `bit_vec` was not passed to another consuming function, e.g. to create a [SPCommand]
|
/// - `bit_vec` was not passed to another consuming function, e.g. to create a [SPCommand]
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub unsafe extern "C" fn sp_bit_vec_free(bit_vec: *mut SPBitVec) {
|
pub unsafe extern "C" fn sp_bitvec_free(bit_vec: *mut SPBitVec) {
|
||||||
assert!(!bit_vec.is_null());
|
assert!(!bit_vec.is_null());
|
||||||
_ = Box::from_raw(bit_vec);
|
_ = Box::from_raw(bit_vec);
|
||||||
}
|
}
|
||||||
|
@ -152,7 +152,7 @@ pub unsafe extern "C" fn sp_bit_vec_free(bit_vec: *mut SPBitVec) {
|
||||||
/// - `bit_vec` points to a valid [SPBitVec]
|
/// - `bit_vec` points to a valid [SPBitVec]
|
||||||
/// - `bit_vec` is not written to concurrently
|
/// - `bit_vec` is not written to concurrently
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub unsafe extern "C" fn sp_bit_vec_get(
|
pub unsafe extern "C" fn sp_bitvec_get(
|
||||||
bit_vec: *const SPBitVec,
|
bit_vec: *const SPBitVec,
|
||||||
index: usize,
|
index: usize,
|
||||||
) -> bool {
|
) -> bool {
|
||||||
|
@ -180,7 +180,7 @@ pub unsafe extern "C" fn sp_bit_vec_get(
|
||||||
/// - `bit_vec` points to a valid [SPBitVec]
|
/// - `bit_vec` points to a valid [SPBitVec]
|
||||||
/// - `bit_vec` is not written to or read from concurrently
|
/// - `bit_vec` is not written to or read from concurrently
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub unsafe extern "C" fn sp_bit_vec_set(
|
pub unsafe extern "C" fn sp_bitvec_set(
|
||||||
bit_vec: *mut SPBitVec,
|
bit_vec: *mut SPBitVec,
|
||||||
index: usize,
|
index: usize,
|
||||||
value: bool,
|
value: bool,
|
||||||
|
@ -207,7 +207,7 @@ pub unsafe extern "C" fn sp_bit_vec_set(
|
||||||
/// - `bit_vec` points to a valid [SPBitVec]
|
/// - `bit_vec` points to a valid [SPBitVec]
|
||||||
/// - `bit_vec` is not written to or read from concurrently
|
/// - `bit_vec` is not written to or read from concurrently
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub unsafe extern "C" fn sp_bit_vec_fill(bit_vec: *mut SPBitVec, value: bool) {
|
pub unsafe extern "C" fn sp_bitvec_fill(bit_vec: *mut SPBitVec, value: bool) {
|
||||||
assert!(!bit_vec.is_null());
|
assert!(!bit_vec.is_null());
|
||||||
(*bit_vec).0.fill(value)
|
(*bit_vec).0.fill(value)
|
||||||
}
|
}
|
||||||
|
@ -228,7 +228,7 @@ pub unsafe extern "C" fn sp_bit_vec_fill(bit_vec: *mut SPBitVec, value: bool) {
|
||||||
///
|
///
|
||||||
/// - `bit_vec` points to a valid [SPBitVec]
|
/// - `bit_vec` points to a valid [SPBitVec]
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub unsafe extern "C" fn sp_bit_vec_len(bit_vec: *const SPBitVec) -> usize {
|
pub unsafe extern "C" fn sp_bitvec_len(bit_vec: *const SPBitVec) -> usize {
|
||||||
assert!(!bit_vec.is_null());
|
assert!(!bit_vec.is_null());
|
||||||
(*bit_vec).0.len()
|
(*bit_vec).0.len()
|
||||||
}
|
}
|
||||||
|
@ -249,7 +249,7 @@ pub unsafe extern "C" fn sp_bit_vec_len(bit_vec: *const SPBitVec) -> usize {
|
||||||
///
|
///
|
||||||
/// - `bit_vec` points to a valid [SPBitVec]
|
/// - `bit_vec` points to a valid [SPBitVec]
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub unsafe extern "C" fn sp_bit_vec_is_empty(bit_vec: *const SPBitVec) -> bool {
|
pub unsafe extern "C" fn sp_bitvec_is_empty(bit_vec: *const SPBitVec) -> bool {
|
||||||
assert!(!bit_vec.is_null());
|
assert!(!bit_vec.is_null());
|
||||||
(*bit_vec).0.is_empty()
|
(*bit_vec).0.is_empty()
|
||||||
}
|
}
|
||||||
|
@ -272,7 +272,7 @@ pub unsafe extern "C" fn sp_bit_vec_is_empty(bit_vec: *const SPBitVec) -> bool {
|
||||||
/// - the returned memory range is never accessed after the passed [SPBitVec] has been freed
|
/// - the returned memory range is never accessed after the passed [SPBitVec] has been freed
|
||||||
/// - the returned memory range is never accessed concurrently, either via the [SPBitVec] or directly
|
/// - the returned memory range is never accessed concurrently, either via the [SPBitVec] or directly
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub unsafe extern "C" fn sp_bit_vec_unsafe_data_ref(
|
pub unsafe extern "C" fn sp_bitvec_unsafe_data_ref(
|
||||||
bit_vec: *mut SPBitVec,
|
bit_vec: *mut SPBitVec,
|
||||||
) -> SPByteSlice {
|
) -> SPByteSlice {
|
||||||
assert!(!bit_vec.is_null());
|
assert!(!bit_vec.is_null());
|
||||||
|
|
|
@ -37,10 +37,10 @@ namespace ServicePoint.BindGen
|
||||||
/// The caller has to make sure that:
|
/// The caller has to make sure that:
|
||||||
///
|
///
|
||||||
/// - the returned instance is freed in some way, either by using a consuming function or
|
/// - the returned instance is freed in some way, either by using a consuming function or
|
||||||
/// by explicitly calling `sp_bit_vec_free`.
|
/// by explicitly calling `sp_bitvec_free`.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DllImport(__DllName, EntryPoint = "sp_bit_vec_new", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
[DllImport(__DllName, EntryPoint = "sp_bitvec_new", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
||||||
public static extern BitVec* sp_bit_vec_new(nuint size);
|
public static extern BitVec* sp_bitvec_new(nuint size);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Interpret the data as a series of bits and load then into a new [SPBitVec] instance.
|
/// Interpret the data as a series of bits and load then into a new [SPBitVec] instance.
|
||||||
|
@ -58,10 +58,10 @@ namespace ServicePoint.BindGen
|
||||||
/// - `data` points to a valid memory location of at least `data_length`
|
/// - `data` points to a valid memory location of at least `data_length`
|
||||||
/// bytes in size.
|
/// bytes in size.
|
||||||
/// - the returned instance is freed in some way, either by using a consuming function or
|
/// - the returned instance is freed in some way, either by using a consuming function or
|
||||||
/// by explicitly calling `sp_bit_vec_free`.
|
/// by explicitly calling `sp_bitvec_free`.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DllImport(__DllName, EntryPoint = "sp_bit_vec_load", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
[DllImport(__DllName, EntryPoint = "sp_bitvec_load", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
||||||
public static extern BitVec* sp_bit_vec_load(byte* data, nuint data_length);
|
public static extern BitVec* sp_bitvec_load(byte* data, nuint data_length);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Clones a [SPBitVec].
|
/// Clones a [SPBitVec].
|
||||||
|
@ -79,10 +79,10 @@ namespace ServicePoint.BindGen
|
||||||
/// - `bit_vec` points to a valid [SPBitVec]
|
/// - `bit_vec` points to a valid [SPBitVec]
|
||||||
/// - `bit_vec` is not written to concurrently
|
/// - `bit_vec` is not written to concurrently
|
||||||
/// - the returned instance is freed in some way, either by using a consuming function or
|
/// - the returned instance is freed in some way, either by using a consuming function or
|
||||||
/// by explicitly calling `sp_bit_vec_free`.
|
/// by explicitly calling `sp_bitvec_free`.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DllImport(__DllName, EntryPoint = "sp_bit_vec_clone", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
[DllImport(__DllName, EntryPoint = "sp_bitvec_clone", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
||||||
public static extern BitVec* sp_bit_vec_clone(BitVec* bit_vec);
|
public static extern BitVec* sp_bitvec_clone(BitVec* bit_vec);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Deallocates a [SPBitVec].
|
/// Deallocates a [SPBitVec].
|
||||||
|
@ -99,8 +99,8 @@ namespace ServicePoint.BindGen
|
||||||
/// - `bit_vec` is not used concurrently or after this call
|
/// - `bit_vec` is not used concurrently or after this call
|
||||||
/// - `bit_vec` was not passed to another consuming function, e.g. to create a [SPCommand]
|
/// - `bit_vec` was not passed to another consuming function, e.g. to create a [SPCommand]
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DllImport(__DllName, EntryPoint = "sp_bit_vec_free", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
[DllImport(__DllName, EntryPoint = "sp_bitvec_free", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
||||||
public static extern void sp_bit_vec_free(BitVec* bit_vec);
|
public static extern void sp_bitvec_free(BitVec* bit_vec);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the value of a bit from the [SPBitVec].
|
/// Gets the value of a bit from the [SPBitVec].
|
||||||
|
@ -124,9 +124,9 @@ namespace ServicePoint.BindGen
|
||||||
/// - `bit_vec` points to a valid [SPBitVec]
|
/// - `bit_vec` points to a valid [SPBitVec]
|
||||||
/// - `bit_vec` is not written to concurrently
|
/// - `bit_vec` is not written to concurrently
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DllImport(__DllName, EntryPoint = "sp_bit_vec_get", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
[DllImport(__DllName, EntryPoint = "sp_bitvec_get", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
||||||
[return: MarshalAs(UnmanagedType.U1)]
|
[return: MarshalAs(UnmanagedType.U1)]
|
||||||
public static extern bool sp_bit_vec_get(BitVec* bit_vec, nuint index);
|
public static extern bool sp_bitvec_get(BitVec* bit_vec, nuint index);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Sets the value of a bit in the [SPBitVec].
|
/// Sets the value of a bit in the [SPBitVec].
|
||||||
|
@ -149,8 +149,8 @@ namespace ServicePoint.BindGen
|
||||||
/// - `bit_vec` points to a valid [SPBitVec]
|
/// - `bit_vec` points to a valid [SPBitVec]
|
||||||
/// - `bit_vec` is not written to or read from concurrently
|
/// - `bit_vec` is not written to or read from concurrently
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DllImport(__DllName, EntryPoint = "sp_bit_vec_set", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
[DllImport(__DllName, EntryPoint = "sp_bitvec_set", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
||||||
public static extern void sp_bit_vec_set(BitVec* bit_vec, nuint index, [MarshalAs(UnmanagedType.U1)] bool value);
|
public static extern void sp_bitvec_set(BitVec* bit_vec, nuint index, [MarshalAs(UnmanagedType.U1)] bool value);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Sets the value of all bits in the [SPBitVec].
|
/// Sets the value of all bits in the [SPBitVec].
|
||||||
|
@ -171,8 +171,8 @@ namespace ServicePoint.BindGen
|
||||||
/// - `bit_vec` points to a valid [SPBitVec]
|
/// - `bit_vec` points to a valid [SPBitVec]
|
||||||
/// - `bit_vec` is not written to or read from concurrently
|
/// - `bit_vec` is not written to or read from concurrently
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DllImport(__DllName, EntryPoint = "sp_bit_vec_fill", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
[DllImport(__DllName, EntryPoint = "sp_bitvec_fill", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
||||||
public static extern void sp_bit_vec_fill(BitVec* bit_vec, [MarshalAs(UnmanagedType.U1)] bool value);
|
public static extern void sp_bitvec_fill(BitVec* bit_vec, [MarshalAs(UnmanagedType.U1)] bool value);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the length of the [SPBitVec] in bits.
|
/// Gets the length of the [SPBitVec] in bits.
|
||||||
|
@ -191,8 +191,8 @@ namespace ServicePoint.BindGen
|
||||||
///
|
///
|
||||||
/// - `bit_vec` points to a valid [SPBitVec]
|
/// - `bit_vec` points to a valid [SPBitVec]
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DllImport(__DllName, EntryPoint = "sp_bit_vec_len", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
[DllImport(__DllName, EntryPoint = "sp_bitvec_len", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
||||||
public static extern nuint sp_bit_vec_len(BitVec* bit_vec);
|
public static extern nuint sp_bitvec_len(BitVec* bit_vec);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns true if length is 0.
|
/// Returns true if length is 0.
|
||||||
|
@ -211,9 +211,9 @@ namespace ServicePoint.BindGen
|
||||||
///
|
///
|
||||||
/// - `bit_vec` points to a valid [SPBitVec]
|
/// - `bit_vec` points to a valid [SPBitVec]
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DllImport(__DllName, EntryPoint = "sp_bit_vec_is_empty", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
[DllImport(__DllName, EntryPoint = "sp_bitvec_is_empty", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
||||||
[return: MarshalAs(UnmanagedType.U1)]
|
[return: MarshalAs(UnmanagedType.U1)]
|
||||||
public static extern bool sp_bit_vec_is_empty(BitVec* bit_vec);
|
public static extern bool sp_bitvec_is_empty(BitVec* bit_vec);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets an unsafe reference to the data of the [SPBitVec] instance.
|
/// Gets an unsafe reference to the data of the [SPBitVec] instance.
|
||||||
|
@ -234,8 +234,8 @@ namespace ServicePoint.BindGen
|
||||||
/// - the returned memory range is never accessed after the passed [SPBitVec] has been freed
|
/// - the returned memory range is never accessed after the passed [SPBitVec] has been freed
|
||||||
/// - the returned memory range is never accessed concurrently, either via the [SPBitVec] or directly
|
/// - the returned memory range is never accessed concurrently, either via the [SPBitVec] or directly
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DllImport(__DllName, EntryPoint = "sp_bit_vec_unsafe_data_ref", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
[DllImport(__DllName, EntryPoint = "sp_bitvec_unsafe_data_ref", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
||||||
public static extern ByteSlice sp_bit_vec_unsafe_data_ref(BitVec* bit_vec);
|
public static extern ByteSlice sp_bitvec_unsafe_data_ref(BitVec* bit_vec);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates a new [SPBrightnessGrid] with the specified dimensions.
|
/// Creates a new [SPBrightnessGrid] with the specified dimensions.
|
||||||
|
|
|
@ -8,7 +8,7 @@ public sealed class BitVec : SpNativeInstance<BindGen.BitVec>
|
||||||
{
|
{
|
||||||
unsafe
|
unsafe
|
||||||
{
|
{
|
||||||
return new BitVec(NativeMethods.sp_bit_vec_new((nuint)size));
|
return new BitVec(NativeMethods.sp_bitvec_new((nuint)size));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ public sealed class BitVec : SpNativeInstance<BindGen.BitVec>
|
||||||
{
|
{
|
||||||
fixed (byte* bytesPtr = bytes)
|
fixed (byte* bytesPtr = bytes)
|
||||||
{
|
{
|
||||||
return new BitVec(NativeMethods.sp_bit_vec_load(bytesPtr, (nuint)bytes.Length));
|
return new BitVec(NativeMethods.sp_bitvec_load(bytesPtr, (nuint)bytes.Length));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -27,7 +27,7 @@ public sealed class BitVec : SpNativeInstance<BindGen.BitVec>
|
||||||
{
|
{
|
||||||
unsafe
|
unsafe
|
||||||
{
|
{
|
||||||
return new BitVec(NativeMethods.sp_bit_vec_clone(Instance));
|
return new BitVec(NativeMethods.sp_bitvec_clone(Instance));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,14 +37,14 @@ public sealed class BitVec : SpNativeInstance<BindGen.BitVec>
|
||||||
{
|
{
|
||||||
unsafe
|
unsafe
|
||||||
{
|
{
|
||||||
return NativeMethods.sp_bit_vec_get(Instance, (nuint)index);
|
return NativeMethods.sp_bitvec_get(Instance, (nuint)index);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
unsafe
|
unsafe
|
||||||
{
|
{
|
||||||
NativeMethods.sp_bit_vec_set(Instance, (nuint)index, value);
|
NativeMethods.sp_bitvec_set(Instance, (nuint)index, value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -53,7 +53,7 @@ public sealed class BitVec : SpNativeInstance<BindGen.BitVec>
|
||||||
{
|
{
|
||||||
unsafe
|
unsafe
|
||||||
{
|
{
|
||||||
NativeMethods.sp_bit_vec_fill(Instance, value);
|
NativeMethods.sp_bitvec_fill(Instance, value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -63,7 +63,7 @@ public sealed class BitVec : SpNativeInstance<BindGen.BitVec>
|
||||||
{
|
{
|
||||||
unsafe
|
unsafe
|
||||||
{
|
{
|
||||||
return (int)NativeMethods.sp_bit_vec_len(Instance);
|
return (int)NativeMethods.sp_bitvec_len(Instance);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -74,7 +74,7 @@ public sealed class BitVec : SpNativeInstance<BindGen.BitVec>
|
||||||
{
|
{
|
||||||
unsafe
|
unsafe
|
||||||
{
|
{
|
||||||
var slice = NativeMethods.sp_bit_vec_unsafe_data_ref(Instance);
|
var slice = NativeMethods.sp_bitvec_unsafe_data_ref(Instance);
|
||||||
return new Span<byte>(slice.start, (int)slice.length);
|
return new Span<byte>(slice.start, (int)slice.length);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -84,5 +84,5 @@ public sealed class BitVec : SpNativeInstance<BindGen.BitVec>
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
private protected override unsafe void Free() => NativeMethods.sp_bit_vec_free(Instance);
|
private protected override unsafe void Free() => NativeMethods.sp_bitvec_free(Instance);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue