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.5 KiB
1.5 KiB
Uint64 Type Functionalities Overview
The obifp package provides a custom Uint64 type wrapping Go’s native 64-bit unsigned integer (uint64) to support arithmetic, bitwise operations, and type conversions in a structured way.
Core Operations
Zero()/MaxValue(): Returns the zero and maximum representable values, respectively.IsZero()/Equals(v): Checks if the value is zero or equal to another.Cmp(v),LessThan(v), etc.: Standard comparison operations returning-1/0/+1or boolean results.
Arithmetic with Overflow Detection
- Add/Sub/Mul: Performs 64-bit addition, subtraction, and multiplication.
- Uses
math/bitsfor low-level operations (bits.Add64, etc.). - Panics on overflow (carry ≠ 0), enforcing strict safety.
- Uses
Bitwise Operations
And,Or,Xor,Not(): Standard bitwise logic operations.LeftShift(n)/RightShift(n):- Shifts bits left/right by n positions.
- Uses internal
LeftShift64/RightShift64, supporting carry-in for multi-word arithmetic.
Extended Precision Conversions
Uint128()/Uint256(): Casts the 64-bit value into larger unsigned integer types (zero-extended).Set64(v): Reassigns the internal value from a rawuint64.
Utility & Logging
AsUint64(): Extracts the underlyinguint64.- Warning on overflow in shift operations (e.g., shifts ≥ 128 bits) via
obilog.Warnf.
Designed for use in high-precision or cryptographic contexts where explicit overflow handling and type safety are critical.