marcazar / bitvector Goto Github PK
View Code? Open in Web Editor NEWBitVector Implementation in Nim
Home Page: https://marcazar.github.io/BitVector/
License: MIT License
BitVector Implementation in Nim
Home Page: https://marcazar.github.io/BitVector/
License: MIT License
Line 48 in cd8af9d
Base is not public so it's not very convenient to directly map a chunk of data, like a string, that is already the bitfield we want:
bitField = newBitVector[uint](strBitField.len*8)
copyMem(bitField.Base[0].addr, strBitField[0].unsafeAddr, strBitField.len)
That, or make helper procs to init bitfield from most common sequential data structures. But still I see no harm in making Base public so people can do whatever they want to it.
You need to move the c files up from private
or change the path because right now nimble is not finding it.
Hi @MarcAzar,
Sorry to bother you again, but I'm not sure the constructor is working properly. Here is my code:
echo "bits requested:", ovls[0].l1
var aCoverage = newBitVector[uint](ovls[0].l1)
echo aCoverage
for i in 0..(ovls[0].l1 - 1):
echo i, " ", ovls[0].l1 - 1
aCoverage[i] = 0
here is my printed info:
bits requested:10278
BitVector with capacity of 10240 bits and 160 unique elements
Hitting the assert:
Error: unhandled exception: /home/zkronenberg/tools/nim-pb/nimbleDir/pkgs/BitVector-0.4.8/bitvector.nim(67, 9) `i < b.cap and
0 <= i` Index out of range [AssertionError]
nimble install bitvector
Downloading https://github.com/MarcAzar/BitVector using git
Warning: Package 'BitVector' has an incorrect structure. The top level of the package source directory should contain at most one module, named 'BitVector.nim', but a file named 'bloom.nim' was found. This will be an error in the future.
Hint: If this is the primary source file in the package, rename it to 'BitVector.nim'. If it's a source file required by the main module, or if it is one of several modules exposed by 'BitVector', then move it into a 'BitVector/' subdirectory. If it's a test file or otherwise not required to build the the package 'BitVector.nim', prevent its installation by adding skipFiles = @["bloom.nim"]
to the .nimble file. See https://github.com/nim-lang/nimble#libraries for more info.
Hi @MarcAzar,
It appears that this code yields the wrong size of bit vector, or did I call the API wrong?
var len = 100
var ba = newBitVector[uint](len)
echo ba
return:
BitVector with capacity of 64 bits and 1 unique elements
then :
proc printBv*(bv: BitVector, n: int) =
for i in 0..n-1:
stdout.write(bv[i])
stdout.write('\n')
var len = 100
var ba = newBitVector[uint](len)
echo ba
printBv(ba, len)
result:
Error: unhandled exception: /Users/zkronenberg/.nimble/pkgs/BitVector-0.4.8/bitvector.nim(63, 9) `i < b.cap and 0 <= i` Index out of range [AssertionError] 0000000000000000000000000000000000000000000000000000000000000000Error: execution of an external program failed: '/Users/zkronenberg/Desktop/testbv '
I am getting this error when trying to build.
Error: execution of an external compiler program 'clang -c -w -pthread -I/usr/local/Cellar/nim/0.20.0/nim/lib -I'/Users/dancook/Dropbox (Personal)/GIT/seq-collection' -o /Users/dancook/.cache/nim/sc_d/murmur3.c.o murmur3.c' failed with exit code: 1
clang: error: no such file or directory: 'murmur3.c'
clang: error: no input files
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.