{"_id":"bit-twiddle","_rev":"15-d6104d91505a70e303aacbddb030a93e","name":"bit-twiddle","description":"Bit twiddling hacks for JavaScript","dist-tags":{"latest":"1.0.2"},"versions":{"0.0.0":{"name":"bit-twiddle","version":"0.0.0","description":"Bit twiddling hacks for JavaScript","main":"twiddle.js","scripts":{"test":"tap ./test"},"repository":{"type":"git","url":"git://github.com/mikolalysenko/bit-twiddle.git"},"devDependencies":{"tap":"~0.3.3"},"keywords":["bit","twiddle","hacks","graphics","octree","quadtree"],"author":{"name":"Mikola Lysenko"},"license":"MIT","gitHead":"f0b4adc66dfb632473c57632e87d3a23f3dd2680","_id":"bit-twiddle@0.0.0","dist":{"shasum":"2c9066d07ea89abda828f7e5c3dd796a13966db9","tarball":"https://registry.npmjs.org/bit-twiddle/-/bit-twiddle-0.0.0.tgz","integrity":"sha512-f38mFO0DVZNiKIc34MaTqE0nl4tnGkQWPeoEq4joWd5XbJn4xNzYupc+nkS8wGL3oJZ/O3HaY+wXLc6GJ6vhQQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDrqKih4dXewQEVq3FzMbEnwV6/oiy6Lh/jWVnoUlBzWQIgU6Suhc2E3eFGMha+0JpFtQS6SdahmUOipbWk7YJFPEQ="}]},"_npmVersion":"1.1.70","_npmUser":{"name":"mikolalysenko","email":"mikolalysenko@gmail.com"},"maintainers":[{"name":"mikolalysenko","email":"mikolalysenko@gmail.com"}]},"0.0.1":{"name":"bit-twiddle","version":"0.0.1","description":"Bit twiddling hacks for JavaScript","main":"twiddle.js","scripts":{"test":"tap ./test"},"repository":{"type":"git","url":"git://github.com/mikolalysenko/bit-twiddle.git"},"devDependencies":{"tap":"~0.3.3"},"keywords":["bit","twiddle","hacks","graphics","octree","quadtree"],"author":{"name":"Mikola Lysenko"},"license":"MIT","gitHead":"f0b4adc66dfb632473c57632e87d3a23f3dd2680","_id":"bit-twiddle@0.0.1","dist":{"shasum":"ba2c7f86c62164873b328e796f7d0b2c93961f6f","tarball":"https://registry.npmjs.org/bit-twiddle/-/bit-twiddle-0.0.1.tgz","integrity":"sha512-cHdZJtcpbm4N7cot+8Td+bQGQceM7nLI/6ArRiWKfGgnRuKSMJzwsDbva35hw78QyFRp4DbkNxcOjwustlUdhA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCICYcZnTJP/JTitfiLEYPFp8i/KTs+8Q7D91LxnxfNcjQAiEA71XJplWUW7cXmqbaP074PcN2aDWA+XDCAjLUZh/7Q8Q="}]},"_npmVersion":"1.1.70","_npmUser":{"name":"mikolalysenko","email":"mikolalysenko@gmail.com"},"maintainers":[{"name":"mikolalysenko","email":"mikolalysenko@gmail.com"}]},"0.0.2":{"name":"bit-twiddle","version":"0.0.2","description":"Bit twiddling hacks for JavaScript","main":"twiddle.js","scripts":{"test":"tap ./test"},"repository":{"type":"git","url":"git://github.com/mikolalysenko/bit-twiddle.git"},"devDependencies":{"tap":"~0.3.3"},"keywords":["bit","twiddle","hacks","graphics","octree","quadtree","math","nextPow2","log","shift","combination","permutation","trailing","zero","one","interleave","revere","parity","population","count","exponent","power","sign","min","max"],"author":{"name":"Mikola Lysenko"},"license":"MIT","gitHead":"f0b4adc66dfb632473c57632e87d3a23f3dd2680","_id":"bit-twiddle@0.0.2","dist":{"shasum":"c2eaebb952a3b94acc140497e1cdcd2f1a33f58e","tarball":"https://registry.npmjs.org/bit-twiddle/-/bit-twiddle-0.0.2.tgz","integrity":"sha512-76iFAOrkcuw5UPA30Pt32XaytMHXz/04JembgIwsQAp7ImHYSWNq1shBbrlWf6CUvh1+amQ81LI8hNhqQgsBEw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIGUegsx6fmljYNkB43yT4NMMT6886TZ1Emte/PehO4/mAiEA4BfGMPpeqa0qb7ot+Ll5MP5e3Mwx4pxs4PRBqzi4Qsk="}]},"_from":".","_npmVersion":"1.2.17","_npmUser":{"name":"mikolalysenko","email":"mikolalysenko@gmail.com"},"maintainers":[{"name":"mikolalysenko","email":"mikolalysenko@gmail.com"}]},"1.0.0":{"name":"bit-twiddle","version":"1.0.0","description":"Bit twiddling hacks for JavaScript","main":"twiddle.js","scripts":{"test":"tape test/*.js"},"repository":{"type":"git","url":"git://github.com/mikolalysenko/bit-twiddle.git"},"devDependencies":{},"keywords":["bit","twiddle","hacks","graphics","logarithm","exponent","base 2","binary","arithmetic","octree","quadtree","math","nextPow2","log","shift","combination","permutation","trailing","zero","one","interleave","revere","parity","population","count","exponent","power","sign","min","max"],"author":{"name":"Mikola Lysenko"},"license":"MIT","gitHead":"f0b4adc66dfb632473c57632e87d3a23f3dd2680","dependencies":{"tape":"^2.12.3"},"bugs":{"url":"https://github.com/mikolalysenko/bit-twiddle/issues"},"homepage":"https://github.com/mikolalysenko/bit-twiddle","_id":"bit-twiddle@1.0.0","dist":{"shasum":"3d4a3191a3dcfe9cd8c42fc92f03b1d188bb8193","tarball":"https://registry.npmjs.org/bit-twiddle/-/bit-twiddle-1.0.0.tgz","integrity":"sha512-S4C5Eg1WndWR8ZdlC1GQttMYRGCy3Z6rt1HosIPz03Ar2wlWxhQWKtRWX70/jntuuc6x5dj2eHb14+rfOaFClA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQC6P8oQJOcMS9cVKc1iEOGx7GB/1Tq3KEvTnpKYO1CjYgIgYwgvpkpDO1iL+ryl9ZRi03QbFQopF9MuweXJ8y2DPgM="}]},"_from":".","_npmVersion":"1.4.3","_npmUser":{"name":"mikolalysenko","email":"mikolalysenko@gmail.com"},"maintainers":[{"name":"mikolalysenko","email":"mikolalysenko@gmail.com"}]},"1.0.1":{"name":"bit-twiddle","version":"1.0.1","description":"Bit twiddling hacks for JavaScript","main":"twiddle.js","scripts":{"test":"tape test/*.js"},"repository":{"type":"git","url":"git://github.com/mikolalysenko/bit-twiddle.git"},"devDependencies":{"tape":"^2.12.3"},"keywords":["bit","twiddle","hacks","graphics","logarithm","exponent","base 2","binary","arithmetic","octree","quadtree","math","nextPow2","log","shift","combination","permutation","trailing","zero","one","interleave","revere","parity","population","count","exponent","power","sign","min","max"],"author":{"name":"Mikola Lysenko"},"license":"MIT","gitHead":"f0b4adc66dfb632473c57632e87d3a23f3dd2680","bugs":{"url":"https://github.com/mikolalysenko/bit-twiddle/issues"},"homepage":"https://github.com/mikolalysenko/bit-twiddle","_id":"bit-twiddle@1.0.1","dist":{"shasum":"d01013da715e34498377c48097b1c78dca7afad0","tarball":"https://registry.npmjs.org/bit-twiddle/-/bit-twiddle-1.0.1.tgz","integrity":"sha512-Z/g9QWfe1AiZuolEAtEoku5+rIV+F/X7TtnELoOuoiPcaj+ykgkfBjFyfUwzvhGBTUCkHEAnUh22zkBL/erAAw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDEUxO9b68oW9SkX45i3q+0CnmNbE0NAHyNKzPffBDf4wIgJ+mN6al+PftzUvuIWmR8caq6M8LAKQ+ZHl9DaJAw4m0="}]},"_from":".","_npmVersion":"1.4.3","_npmUser":{"name":"mikolalysenko","email":"mikolalysenko@gmail.com"},"maintainers":[{"name":"mikolalysenko","email":"mikolalysenko@gmail.com"}]},"1.0.2":{"name":"bit-twiddle","version":"1.0.2","description":"Bit twiddling hacks for JavaScript","main":"twiddle.js","scripts":{"test":"tape test/*.js"},"repository":{"type":"git","url":"git://github.com/mikolalysenko/bit-twiddle.git"},"devDependencies":{"tape":"^2.12.3"},"keywords":["bit","twiddle","hacks","graphics","logarithm","exponent","base 2","binary","arithmetic","octree","quadtree","math","nextPow2","log","shift","combination","permutation","trailing","zero","one","interleave","revere","parity","population","count","exponent","power","sign","min","max"],"author":{"name":"Mikola Lysenko"},"license":"MIT","gitHead":"f0b4adc66dfb632473c57632e87d3a23f3dd2680","testling":{"files":"test/*.js","browsers":["ie/8..latest","firefox/17..latest","firefox/nightly","chrome/22..latest","chrome/canary","opera/12..latest","opera/next","safari/5.1..latest","ipad/6.0..latest","iphone/6.0..latest","android-browser/4.2..latest"]},"bugs":{"url":"https://github.com/mikolalysenko/bit-twiddle/issues"},"homepage":"https://github.com/mikolalysenko/bit-twiddle","_id":"bit-twiddle@1.0.2","dist":{"shasum":"0c6c1fabe2b23d17173d9a61b7b7093eb9e1769e","tarball":"https://registry.npmjs.org/bit-twiddle/-/bit-twiddle-1.0.2.tgz","integrity":"sha512-B9UhK0DKFZhoTFcfvAzhqsjStvGJp9vYWf3+6SNTtdSQnvIgfkHbgHrg/e4+TH71N2GDu8tpmCVoyfrL1d7ntA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQC/vLX1HXjKknRbYfDjOOv5UIhjbqTT2DA/nE4grWHG4gIgctFdcNITUwl9ZeVQjuZt/rYOBh6xhZKGWlMvrJ70OVU="}]},"_from":".","_npmVersion":"1.4.3","_npmUser":{"name":"mikolalysenko","email":"mikolalysenko@gmail.com"},"maintainers":[{"name":"mikolalysenko","email":"mikolalysenko@gmail.com"}]}},"readme":"bit-twiddle\n===========\n\nThis is a collection of miscellaneous bit twiddling hacks ported to JavaScript, mostly taken from here:\n\n* [Stanford Bit Twiddling Hacks](http://graphics.stanford.edu/~seander/bithacks.html)\n\n[![testling badge](https://ci.testling.com/mikolalysenko/bit-twiddle.png)](https://ci.testling.com/mikolalysenko/bit-twiddle)\n\n[![build status](https://secure.travis-ci.org/mikolalysenko/bit-twiddle.png)](http://travis-ci.org/mikolalysenko/bit-twiddle)\n\nInstall\n=======\nVia npm:\n\n    npm install bit-twiddle\n\n# API\n\n### `sign(v)`\nComputes the sign of the integer v.  Returns:\n* -1 if v < 0\n*  0 if v === 0\n* +1 if v > 0\n\n### `abs(v)`\nReturns the absolute value of the integer v\n\n### `min(x,y)`\nComputes the minimum of integers x and y\n\n### `max(x,y)`\nComputes the maximum of integers x and y\n\n### `isPow2(v)`\nReturns `true` if v is a power of 2, otherwise false.\n\n### `log2(v)`\nReturns an integer approximation of the log-base 2 of v\n\n### `log10(v)`\nReturns log base 10 of v.\n\n### `popCount(v)`\nCounts the number of bits set in v\n\n###  `countTrailingZeros(v)`\nCounts the number of trailing zeros.\n\n### `nextPow2(v)`\nRounds v up to the next power of 2.\n\n### `prevPow2(v)`\nRounds v down to the previous power of 2.\n\n### `parity(v)`\nComputes the parity of the bits in v.\n\n### `reverse(v)`\nReverses the bits of v.\n\n### `interleave2(x,y)`\nInterleaves a pair of 16 bit integers.  Useful for fast quadtree style indexing.  (See wiki: http://en.wikipedia.org/wiki/Z-order_curve )\n\n### `deinterleave2(v, n)`\nDeinterleaves the bits of v, returns the nth part.  If both x and y are 16 bit, then it is true that:\n\n```javascript\ndeinterleave2(interleave2(x,y), 0) === x\ndeinterleave2(interleave2(x,y), 1) === y\n```\n    \n### `interleave3(x,y,z)`\nInterleaves a triple of 10 bit integers.  Useful for fast octree indexing.\n\n### `deinterleave3(v, n)`\nSame deal as `deinterleave2`, only for triples instead of pairs\n\n### `nextCombination(x)`\nReturns next combination ordered colexicographically.\n\nAcknowledgements\n================\nCode is ported from Sean Eron Anderson's public domain bit twiddling hacks page.  http://graphics.stanford.edu/~seander/bithacks.html\nJavaScript implementation (c) 2013 Mikola Lysenko.  MIT License\n","maintainers":[{"name":"mikolalysenko","email":"mikolalysenko@gmail.com"}],"time":{"modified":"2022-06-13T04:41:18.834Z","created":"2013-01-15T20:52:10.008Z","0.0.0":"2013-01-15T20:52:10.664Z","0.0.1":"2013-01-16T06:38:38.630Z","0.0.2":"2013-04-12T15:05:16.951Z","1.0.0":"2014-04-28T23:51:59.519Z","1.0.1":"2014-04-30T23:24:58.159Z","1.0.2":"2014-05-28T16:14:46.891Z"},"author":{"name":"Mikola Lysenko"},"repository":{"type":"git","url":"git://github.com/mikolalysenko/bit-twiddle.git"},"homepage":"https://github.com/mikolalysenko/bit-twiddle","keywords":["bit","twiddle","hacks","graphics","logarithm","exponent","base 2","binary","arithmetic","octree","quadtree","math","nextPow2","log","shift","combination","permutation","trailing","zero","one","interleave","revere","parity","population","count","exponent","power","sign","min","max"],"bugs":{"url":"https://github.com/mikolalysenko/bit-twiddle/issues"},"license":"MIT","readmeFilename":"README.md"}