Skip to content

Commit

Permalink
Merge pull request #16 from tkelman/compat
Browse files Browse the repository at this point in the history
Use Compat, test both nightly and release on Travis

OK – I'm going to merge this in, then release v0.1.1 and push an updated METADATA.jl, then properly tag the releases here to match (I'm not intimately familiar with the package system for Julia, so didn't realize it was doing the tagging in the METADATA.jl repo rather than pulling tags from here)
  • Loading branch information
boydgreenfield committed Mar 19, 2015
2 parents bdfae54 + 5b631ec commit a62323c
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 13 deletions.
22 changes: 11 additions & 11 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
language: cpp
compiler:
- clang
language: julia
os:
- linux
- osx
julia:
- release
- nightly
notifications:
email: false
before_install:
- sudo add-apt-repository ppa:staticfloat/julia-deps -y
- sudo add-apt-repository ppa:staticfloat/julianightlies -y
- sudo apt-get update -qq -y
- sudo apt-get install libpcre3-dev julia -y
script:
- julia -e 'Pkg.init(); run(`ln -s $(pwd()) $(Pkg.dir("BloomFilters"))`); Pkg.pin("BloomFilters"); Pkg.resolve()'
- julia -e 'using BloomFilters; @assert isdefined(:BloomFilters); @assert typeof(BloomFilters) === Module; include(joinpath(Pkg.dir("BloomFilters"), "test/runtests.jl"))'
# uncomment the following lines to override the default test script
#script:
# - if [[ -a .git/shallow ]]; then git fetch --unshallow; fi
# - julia --check-bounds=yes -e 'Pkg.clone(pwd()); Pkg.build("BloomFilters"); Pkg.test("BloomFilters"; coverage=true)'
1 change: 1 addition & 0 deletions REQUIRE
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
julia 0.3.1-
Compat
6 changes: 4 additions & 2 deletions src/bloom-filter.jl
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
using Compat

include("probabilities.jl")

type BloomFilter
Expand All @@ -15,8 +17,8 @@ end
# which uses 2 hash functions vs. k and has comparable properties
# See Kirsch and Mitzenmacher, 2008: http://www.eecs.harvard.edu/~kirsch/pubs/bbbf/rsa.pdf
function hash_n(key::Any, k::Int, max::Int)
a_hash = hash(key, UInt(0))
b_hash = hash(key, UInt(170))
a_hash = hash(key, @compat UInt(0))
b_hash = hash(key, @compat UInt(170))
hashes = Array(Uint, k)
for i in 1:k
hashes[i] = mod(a_hash + i * b_hash, max) + 1
Expand Down

0 comments on commit a62323c

Please sign in to comment.