Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
[![Build Status](https://github.com/QuantumBFS/BitBasis.jl/workflows/CI/badge.svg)](https://github.com/QuantumBFS/BitBasis.jl/actions)
[![Codecov](https://codecov.io/gh/QuantumBFS/BitBasis.jl/branch/master/graph/badge.svg)](https://codecov.io/gh/QuantumBFS/BitBasis.jl)
[![Aqua QA](https://img.shields.io/badge/Aqua.jl-%F0%9F%8C%A2-aqua.svg)](https://github.com/JuliaTesting/Aqua.jl)
![Agent maintained](https://img.shields.io/badge/maintenance-agent%20maintained-blue)


Types and operations for basis represented by bits in linear algebra.
Expand Down
28 changes: 25 additions & 3 deletions src/longlonguint.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,29 @@
"""
LongLongUInt{C} <: Integer
LongLongUInt{C} <: Unsigned

A `LongLongUInt{C}` is an integer with `C` `UInt` numbers to store the value.
A fixed-width unsigned integer stored in `C` machine-word-sized `UInt` values.
The first element of `content` is the most significant word and the last is the
least significant word, so the width is `C * sizeof(UInt) * 8` bits. Arithmetic
is fixed-width and discards overflow beyond that width.

Construct a value from a tuple of words or convert an integer to an explicitly
sized value. `LongLongUInt` supports comparisons, bitwise operations, shifts,
addition, subtraction, multiplication, division, and conversion to `BigInt`.

# Examples

```jldoctest
julia> x = LongLongUInt((0x0000000000000001, 0x0000000000000002));

julia> BigInt(x) == (big(1) << 64) + 2
true

julia> x >> 64 == LongLongUInt((0x0000000000000000, 0x0000000000000001))
true

julia> typemax(UInt) * LongLongUInt{1}(2) == LongLongUInt{1}(typemax(UInt) - 1)
true
```
"""
struct LongLongUInt{C} <: Unsigned
content::NTuple{C, UInt}
Expand Down Expand Up @@ -234,4 +256,4 @@ function Base.hash(bits_tuple::Tuple{LongLongUInt{C}, Vararg{LongLongUInt{C}, M}
hash0 = Base.hash(bits_tuple[i].content, hash0)
end
return hash0
end
end
Loading