mirror of
https://github.com/metabarcoding/obitools4.git
synced 2026-04-30 12:00:39 +00:00
8c7017a99d
- Update obioptions.Version from "Release 4.4.29" to "/v/ Release v5" - Update version.txt from 4.29 → .30 (automated by Makefile)
1.3 KiB
1.3 KiB
obifp.Uint128 Package — Semantic Feature Overview
This Go package provides a 128-bit unsigned integer type (Uint128) with comprehensive arithmetic, comparison, and bitwise operations. Internally represented as two uint64 limbs (w1: high, w0: low), it supports:
- Arithmetic Operations
Add,Sub,Mul(128×128), andMul64(scalar multiplication)- Division:
Div,Mod, and combined quotient/remainder viaQuoRem(and their 64-bit variants)
- Comparison & Equality
Cmp,Equals,LessThan/GreaterThan, and their inclusive variants (≤,≥)- Support for comparing against both
Uint128and nativeuint64values
- Bitwise Operations
- Logical AND (
And), OR (Or), XOR (Xor) between twoUint128s - Bitwise NOT (
Not) — inverts all bits of the value
- Logical AND (
- Conversion & Utility
AsUint64()safely truncates to lower 64 bits (assumes upper limb is zero)
All operations handle overflow/underflow correctly, including carry propagation in addition and borrow handling in subtraction. Tests cover edge cases: zero values, max uint64 boundaries (e.g., wrapping in addition/subtraction), and large multiplications. Designed for cryptographic or high-precision numeric use where native integer types are insufficient.