Skip to content

Tier_2_Features

David Crook edited this page Dec 18, 2016 · 2 revisions

Tier 2 Features

WIP

Composition

bvr = bv1 + bv2     // Concatenate 
bv[0..<31] = bv32   // Overlay

Func with other formats

bv.hexStringed()         // hexString value
bv.hexDebugStringed()    // hexString value in init() format
bv.textStringed()        // bits converted to bytes, then to a Unicode (UTF-8) string
bv.bitArrayed()          // bits in bit array

bv.hexDecodedRange(4..<11)  // hex Representation of bits [4:10]

Bit operations

let bvRotatedLeft = bv.rotatedLeft(5)     // 
let bvRotatedRight = bv.rotatedRight(5)   // 
let bvShiftedLeft = bv.shiftedLeft(5)     // 
let bvShiftedRight = bv.shiftedRight(5)   // 

let populationCount = bv.popcnt()         // number of bits set
let trueOrFalse = bv.singleBitSetOnly()   // whether a solitary bit is set 

Clone this wiki locally