Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

MurrellGroup/BitPacking.jl

Open more actions menu

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
33 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

BitPacking.jl

Stable Dev Build Status Coverage

BitPacking.jl provides small bit-packed building blocks for Julia array code:

  • NArray, NVector, and NMatrix pack a static group of narrow values into one storage value.
  • NarrowArray, NarrowVector, and NarrowMatrix view an array of packed groups as a logical array of values.
  • NarrowTuple and @NarrowTuple pack heterogeneous isbits values, with optional padding fields.

Packages can extend BitPacking.bitwidth(::Type) for their own narrow scalar types.

Examples

using BitPacking

v = NVector(true, false, true, false, true, false, true, false)

Tuple(v)                 # (true, false, true, false, true, false, true, false)
reinterpret(UInt8, v)    # 0x55
x = Bool[1, 0, 1, 0, 1, 0, 1, 0]
packed = NarrowArray{Bool}(x)

copy(packed) == x        # true
parent(packed)           # Vector{NVector{Bool,8}}
t = @NarrowTuple(0x12, true)

Tuple(t)                 # (0x12, true)
BitPacking.bitwidth(t)   # 9

Installation

using Pkg
Pkg.add("BitPacking")

Releases

Contributors

Languages

Morty Proxy This is a proxified and sanitized view of the page, visit original site.