- 评分
- —
- 暂无评分
- 价格
- 免费
- 版本
- 1
- 2026年11月6日
- 开发者
- SignalPlus
关于这个库
LibReviewQA
Small integer helpers (wrapping add, saturating multiply) published by the platform team to exercise Marketplace Library review end to end. Pure compute — the consuming app passes integers in and gets integers back; the library performs no I/O and keeps no state.
Interface
All functions use the C ABI (see include/01a1b01b-9b1a-7271-9366-b36f2024e789.h). Scalars only.
sp2_01a1b01b_9b1a_7271_9366_b36f2024e789_init() -> i32
One-time initialisation. The consuming app MUST call this exactly once from its init() before any other function. Returns 0 on success.
| Return | Meaning | | ------ | ------- | | 0 | success (the only value returned) |
sp2_01a1b01b_9b1a_7271_9366_b36f2024e789_add(a: i32, b: i32) -> i32
Returns a + b with two's-complement wrapping on overflow (for example add(i32::MAX, 1) == i32::MIN). Never fails.
sp2_01a1b01b_9b1a_7271_9366_b36f2024e789_mul_saturating(a: i32, b: i32) -> i32
Returns a * b, clamped to i32::MIN / i32::MAX when the exact product does not fit (for example mul_saturating(65536, 65536) == i32::MAX). Never fails.
Usage in a consuming app
backend/Cargo.toml (rename the dependency — the raw crate name is not a valid Rust identifier):
[dependencies]
mylib = { package = "sp2019e3a82f6bc77ee9a56cfbd377c5f5f-01a1b01b-9b1a-7271-9366-b36f2024e789-sys", version = "0.1.2", registry = "sp2-cargo" }backend/src/lib.rs:
fn try_init() -> Result<(), String> {
let rc = unsafe { mylib::sp2_01a1b01b_9b1a_7271_9366_b36f2024e789_init() };
if rc != 0 {
return Err(format!("lib init failed: {rc}"));
}
let sum = unsafe { mylib::sp2_01a1b01b_9b1a_7271_9366_b36f2024e789_add(1, 2) };
let product = unsafe { mylib::sp2_01a1b01b_9b1a_7271_9366_b36f2024e789_mul_saturating(sum, 7) };
let _ = product;
Ok(())
}Deployed apps pin exact versions via Cargo.lock.
Versioning & compatibility
- Entitlement is per-lib: one purchase unlocks all released versions; a version priced above what was already paid costs the difference, and zero-difference upgrades apply automatically.
- Breaking the C ABI (changing/removing an exported symbol) requires a new major version.
- 0.1.x: initial interface (
init,add,mul_saturating).
Pricing & entitlement notes
Free test library for platform acceptance; no expiry.
新功能
版本 1 · 2026年11月6日
0.1.2:初始接口(init、add、mul_saturating)。
信息
- 开发者
- SignalPlus
- 类型
- 库
- 价格
- 免费
- Remix
- 不开放 Remix
- 上架时间
- 2026年11月6日
同一开发者的更多作品
App 市场中的 App 由独立开发者制作,上架前经 SignalPlus 审核;介绍文字由开发者提供。本站内容不构成投资建议,也不承诺收益。
