GitHub PullRequestReviewCommentEvent at 2014-09-14 16:18:47
Repository: libreset
Actor: neithernut
Payload: {"action":"created","comment":{"url":"https://api.github.com/repos/matthiasbeyer/libreset/pulls/comments/17520656","id":17520656,"diff_hunk":"@@ -0,0 +1,151 @@\n+/*\n+ * libreset - Reentrent set library for fast set operations in C\n+ *\n+ * Copyright (C) 2014 Matthias Beyer\n+ * Copyright (C) 2014 Julian Ganz\n+ *\n+ * This file is part of libreset.\n+ *\n+ * libreset is free software: you can redistribute it and/or modify it under the\n+ * terms of the GNU Lesser General Public License as published by the Free\n+ * Software Foundation, either version 2.1 of the License, or (at your option)\n+ * any later version.\n+ *\n+ * libreset is distributed in the hope that it will be useful, but WITHOUT ANY\n+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR\n+ * A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more\n+ * details.\n+ *\n+ * You should have received a copy of the GNU Lesser General Public License\n+ * along with libreset. If not, see <http://www.gnu.org/licenses/>.\n+ */\n+#include \"bloom.h\"\n+\n+#include \"params.h\"\n+\n+/*\n+ *\n+ *\n+ * definitions\n+ *\n+ *\n+ */\n+\n+/**\n+ * Number of bits in a bloom filter\n+ */\n+#define BLOOM_BITS (sizeof(bloom)*8)\n+\n+\n+/*\n+ *\n+ *\n+ * forward declarations\n+ *\n+ *\n+ */\n+\n+/**\n+ * Special function only to be used in bloom_may_have_common()\n+ *\n+ * This function will generate a mask to erase each other virtual integer of\n+ * a given width within another int.\n+ *\n+ * @return mask to be used to mask ints\n+ */\n+__const__ bloom\n+erasure_mask(\n+    unsigned int width //!< width of ints to mask\n+);\n+\n+\n+/*\n+ *\n+ *\n+ * interface implementation\n+ *\n+ *\n+ */\n+\n+bloom\n+bloom_from_hash(\n+    rs_hash hash\n+) {\n+    bloom result = 0;\n+\n+    unsigned int vars = HASH_VARIANTS;\n+    while (vars) {\n+        result |= 1 << (hash % BLOOM_BITS);\n+\n+        // transform the hash to generate new variant\n+        hash /= BLOOM_BITS;\n+    }\n+\n+    return result;\n+}\n+\n+int\n+bloom_may_contain(\n+    bloom element,\n+    bloom set\n+) {\n+    return (element & (~set)) == 0;\n+}\n+\n+int\n+bloom_may_have_common(\n+    bloom a,\n+    bloom b\n+) {\n+    // calculate the number of bits common to both filters\n+    bloom section = a & b;\n+\n+    // calculate the number of bits in \"section\"\n+\n+    // to do this, we will consider \"section\" to be made up by ints of single\n+    // bits. Those will be added to ints of two bits, four bits and so on.","path":"src/libreset/bloom.c","position":106,"original_position":106,"commit_id":"0ba82d539af0a044d5faa594a654259ddd2bd59a","original_commit_id":"0ba82d539af0a044d5faa594a654259ddd2bd59a","user":{"login":"neithernut","id":6747556,"avatar_url":"https://avatars.githubusercontent.com/u/6747556?v=2","gravatar_id":"12a1496b38b22082d0f984ee9a0458d8","url":"https://api.github.com/users/neithernut","html_url":"https://github.com/neithernut","followers_url":"https://api.github.com/users/neithernut/followers","following_url":"https://api.github.com/users/neithernut/following{/other_user}","gists_url":"https://api.github.com/users/neithernut/gists{/gist_id}","starred_url":"https://api.github.com/users/neithernut/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/neithernut/subscriptions","organizations_url":"https://api.github.com/users/neithernut/orgs","repos_url":"https://api.github.com/users/neithernut/repos","events_url":"https://api.github.com/users/neithernut/events{/privacy}","received_events_url":"https://api.github.com/users/neithernut/received_events","type":"User","site_admin":false},"body":"I agree, and I usually would not comment this way. However, I do not think that most people would get how it works easily without such extensive comments.","created_at":"2014-09-14T16:18:47Z","updated_at":"2014-09-14T16:18:47Z","html_url":"https://github.com/matthiasbeyer/libreset/pull/88#discussion_r17520656","pull_request_url":"https://api.github.com/repos/matthiasbeyer/libreset/pulls/88","_links":{"self":{"href":"https://api.github.com/repos/matthiasbeyer/libreset/pulls/comments/17520656"},"html":{"href":"https://github.com/matthiasbeyer/libreset/pull/88#discussion_r17520656"},"pull_request":{"href":"https://api.github.com/repos/matthiasbeyer/libreset/pulls/88"}}},"pull_request":{"url":"https://api.github.com/repos/matthiasbeyer/libreset/pulls/88","id":21205313,"html_url":"https://github.com/matthiasbeyer/libreset/pull/88","diff_url":"https://github.com/matthiasbeyer/libreset/pull/88.diff","patch_url":"https://github.com/matthiasbeyer/libreset/pull/88.patch","issue_url":"https://api.github.com/repos/matthiasbeyer/libreset/issues/88","number":88,"state":"open","locked":false,"title":"Add bloom filter","user":{"login":"neithernut","id":6747556,"avatar_url":"https://avatars.githubusercontent.com/u/6747556?v=2","gravatar_id":"12a1496b38b22082d0f984ee9a0458d8","url":"https://api.github.com/users/neithernut","html_url":"https://github.com/neithernut","followers_url":"https://api.github.com/users/neithernut/followers","following_url":"https://api.github.com/users/neithernut/following{/other_user}","gists_url":"https://api.github.com/users/neithernut/gists{/gist_id}","starred_url":"https://api.github.com/users/neithernut/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/neithernut/subscriptions","organizations_url":"https://api.github.com/users/neithernut/orgs","repos_url":"https://api.github.com/users/neithernut/repos","events_url":"https://api.github.com/users/neithernut/events{/privacy}","received_events_url":"https://api.github.com/users/neithernut/received_events","type":"User","site_admin":false},"body":"This PR adds the bloom filter data type and functions.\r\nIt also contains adjustments to the AVL data structure.","created_at":"2014-09-14T15:56:24Z","updated_at":"2014-09-14T16:18:47Z","closed_at":null,"merged_at":null,"merge_commit_sha":"942f409e68e3f59f31217dba31c452a70bdf15d0","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/matthiasbeyer/libreset/pulls/88/commits","review_comments_url":"https://api.github.com/repos/matthiasbeyer/libreset/pulls/88/comments","review_comment_url":"https://api.github.com/repos/matthiasbeyer/libreset/pulls/comments/{number}","comments_url":"https://api.github.com/repos/matthiasbeyer/libreset/issues/88/comments","statuses_url":"https://api.github.com/repos/matthiasbeyer/libreset/statuses/0ba82d539af0a044d5faa594a654259ddd2bd59a","head":{"label":"neithernut:add-bloom_filter","ref":"add-bloom_filter","sha":"0ba82d539af0a044d5faa594a654259ddd2bd59a","user":{"login":"neithernut","id":6747556,"avatar_url":"https://avatars.githubusercontent.com/u/6747556?v=2","gravatar_id":"12a1496b38b22082d0f984ee9a0458d8","url":"https://api.github.com/users/neithernut","html_url":"https://github.com/neithernut","followers_url":"https://api.github.com/users/neithernut/followers","following_url":"https://api.github.com/users/neithernut/following{/other_user}","gists_url":"https://api.github.com/users/neithernut/gists{/gist_id}","starred_url":"https://api.github.com/users/neithernut/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/neithernut/subscriptions","organizations_url":"https://api.github.com/users/neithernut/orgs","repos_url":"https://api.github.com/users/neithernut/repos","events_url":"https://api.github.com/users/neithernut/events{/privacy}","received_events_url":"https://api.github.com/users/neithernut/received_events","type":"User","site_admin":false},"repo":{"id":20659925,"name":"libreset","full_name":"neithernut/libreset","owner":{"login":"neithernut","id":6747556,"avatar_url":"https://avatars.githubusercontent.com/u/6747556?v=2","gravatar_id":"12a1496b38b22082d0f984ee9a0458d8","url":"https://api.github.com/users/neithernut","html_url":"https://github.com/neithernut","followers_url":"https://api.github.com/users/neithernut/followers","following_url":"https://api.github.com/users/neithernut/following{/other_user}","gists_url":"https://api.github.com/users/neithernut/gists{/gist_id}","starred_url":"https://api.github.com/users/neithernut/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/neithernut/subscriptions","organizations_url":"https://api.github.com/users/neithernut/orgs","repos_url":"https://api.github.com/users/neithernut/repos","events_url":"https://api.github.com/users/neithernut/events{/privacy}","received_events_url":"https://api.github.com/users/neithernut/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/neithernut/libreset","description":"Reentrant set lib based on threadsafe hashtable","fork":true,"url":"https://api.github.com/repos/neithernut/libreset","forks_url":"https://api.github.com/repos/neithernut/libreset/forks","keys_url":"https://api.github.com/repos/neithernut/libreset/keys{/key_id}","collaborators_url":"https://api.github.com/repos/neithernut/libreset/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/neithernut/libreset/teams","hooks_url":"https://api.github.com/repos/neithernut/libreset/hooks","issue_events_url":"https://api.github.com/repos/neithernut/libreset/issues/events{/number}","events_url":"https://api.github.com/repos/neithernut/libreset/events","assignees_url":"https://api.github.com/repos/neithernut/libreset/assignees{/user}","branches_url":"https://api.github.com/repos/neithernut/libreset/branches{/branch}","tags_url":"https://api.github.com/repos/neithernut/libreset/tags","blobs_url":"https://api.github.com/repos/neithernut/libreset/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/neithernut/libreset/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/neithernut/libreset/git/refs{/sha}","trees_url":"https://api.github.com/repos/neithernut/libreset/git/trees{/sha}","statuses_url":"https://api.github.com/repos/neithernut/libreset/statuses/{sha}","languages_url":"https://api.github.com/repos/neithernut/libreset/languages","stargazers_url":"https://api.github.com/repos/neithernut/libreset/stargazers","contributors_url":"https://api.github.com/repos/neithernut/libreset/contributors","subscribers_url":"https://api.github.com/repos/neithernut/libreset/subscribers","subscription_url":"https://api.github.com/repos/neithernut/libreset/subscription","commits_url":"https://api.github.com/repos/neithernut/libreset/commits{/sha}","git_commits_url":"https://api.github.com/repos/neithernut/libreset/git/commits{/sha}","comments_url":"https://api.github.com/repos/neithernut/libreset/comments{/number}","issue_comment_url":"https://api.github.com/repos/neithernut/libreset/issues/comments/{number}","contents_url":"https://api.github.com/repos/neithernut/libreset/contents/{+path}","compare_url":"https://api.github.com/repos/neithernut/libreset/compare/{base}...{head}","merges_url":"https://api.github.com/repos/neithernut/libreset/merges","archive_url":"https://api.github.com/repos/neithernut/libreset/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/neithernut/libreset/downloads","issues_url":"https://api.github.com/repos/neithernut/libreset/issues{/number}","pulls_url":"https://api.github.com/repos/neithernut/libreset/pulls{/number}","milestones_url":"https://api.github.com/repos/neithernut/libreset/milestones{/number}","notifications_url":"https://api.github.com/repos/neithernut/libreset/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/neithernut/libreset/labels{/name}","releases_url":"https://api.github.com/repos/neithernut/libreset/releases{/id}","created_at":"2014-06-09T19:48:59Z","updated_at":"2014-09-13T15:50:02Z","pushed_at":"2014-09-14T16:03:29Z","git_url":"git://github.com/neithernut/libreset.git","ssh_url":"git@github.com:neithernut/libreset.git","clone_url":"https://github.com/neithernut/libreset.git","svn_url":"https://github.com/neithernut/libreset","homepage":null,"size":669,"stargazers_count":0,"watchers_count":0,"language":"TeX","has_issues":false,"has_downloads":true,"has_wiki":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"matthiasbeyer:master","ref":"master","sha":"3c7f941a9f15a971a0f29a0f4daeb01172481899","user":{"login":"matthiasbeyer","id":427866,"avatar_url":"https://avatars.githubusercontent.com/u/427866?v=2","gravatar_id":"f98e6ad8c8b579b09886981b1e402c15","url":"https://api.github.com/users/matthiasbeyer","html_url":"https://github.com/matthiasbeyer","followers_url":"https://api.github.com/users/matthiasbeyer/followers","following_url":"https://api.github.com/users/matthiasbeyer/following{/other_user}","gists_url":"https://api.github.com/users/matthiasbeyer/gists{/gist_id}","starred_url":"https://api.github.com/users/matthiasbeyer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/matthiasbeyer/subscriptions","organizations_url":"https://api.github.com/users/matthiasbeyer/orgs","repos_url":"https://api.github.com/users/matthiasbeyer/repos","events_url":"https://api.github.com/users/matthiasbeyer/events{/privacy}","received_events_url":"https://api.github.com/users/matthiasbeyer/received_events","type":"User","site_admin":false},"repo":{"id":20565980,"name":"libreset","full_name":"matthiasbeyer/libreset","owner":{"login":"matthiasbeyer","id":427866,"avatar_url":"https://avatars.githubusercontent.com/u/427866?v=2","gravatar_id":"f98e6ad8c8b579b09886981b1e402c15","url":"https://api.github.com/users/matthiasbeyer","html_url":"https://github.com/matthiasbeyer","followers_url":"https://api.github.com/users/matthiasbeyer/followers","following_url":"https://api.github.com/users/matthiasbeyer/following{/other_user}","gists_url":"https://api.github.com/users/matthiasbeyer/gists{/gist_id}","starred_url":"https://api.github.com/users/matthiasbeyer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/matthiasbeyer/subscriptions","organizations_url":"https://api.github.com/users/matthiasbeyer/orgs","repos_url":"https://api.github.com/users/matthiasbeyer/repos","events_url":"https://api.github.com/users/matthiasbeyer/events{/privacy}","received_events_url":"https://api.github.com/users/matthiasbeyer/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/matthiasbeyer/libreset","description":"Reentrant set lib based on threadsafe hashtable","fork":false,"url":"https://api.github.com/repos/matthiasbeyer/libreset","forks_url":"https://api.github.com/repos/matthiasbeyer/libreset/forks","keys_url":"https://api.github.com/repos/matthiasbeyer/libreset/keys{/key_id}","collaborators_url":"https://api.github.com/repos/matthiasbeyer/libreset/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/matthiasbeyer/libreset/teams","hooks_url":"https://api.github.com/repos/matthiasbeyer/libreset/hooks","issue_events_url":"https://api.github.com/repos/matthiasbeyer/libreset/issues/events{/number}","events_url":"https://api.github.com/repos/matthiasbeyer/libreset/events","assignees_url":"https://api.github.com/repos/matthiasbeyer/libreset/assignees{/user}","branches_url":"https://api.github.com/repos/matthiasbeyer/libreset/branches{/branch}","tags_url":"https://api.github.com/repos/matthiasbeyer/libreset/tags","blobs_url":"https://api.github.com/repos/matthiasbeyer/libreset/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/matthiasbeyer/libreset/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/matthiasbeyer/libreset/git/refs{/sha}","trees_url":"https://api.github.com/repos/matthiasbeyer/libreset/git/trees{/sha}","statuses_url":"https://api.github.com/repos/matthiasbeyer/libreset/statuses/{sha}","languages_url":"https://api.github.com/repos/matthiasbeyer/libreset/languages","stargazers_url":"https://api.github.com/repos/matthiasbeyer/libreset/stargazers","contributors_url":"https://api.github.com/repos/matthiasbeyer/libreset/contributors","subscribers_url":"https://api.github.com/repos/matthiasbeyer/libreset/subscribers","subscription_url":"https://api.github.com/repos/matthiasbeyer/libreset/subscription","commits_url":"https://api.github.com/repos/matthiasbeyer/libreset/commits{/sha}","git_commits_url":"https://api.github.com/repos/matthiasbeyer/libreset/git/commits{/sha}","comments_url":"https://api.github.com/repos/matthiasbeyer/libreset/comments{/number}","issue_comment_url":"https://api.github.com/repos/matthiasbeyer/libreset/issues/comments/{number}","contents_url":"https://api.github.com/repos/matthiasbeyer/libreset/contents/{+path}","compare_url":"https://api.github.com/repos/matthiasbeyer/libreset/compare/{base}...{head}","merges_url":"https://api.github.com/repos/matthiasbeyer/libreset/merges","archive_url":"https://api.github.com/repos/matthiasbeyer/libreset/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/matthiasbeyer/libreset/downloads","issues_url":"https://api.github.com/repos/matthiasbeyer/libreset/issues{/number}","pulls_url":"https://api.github.com/repos/matthiasbeyer/libreset/pulls{/number}","milestones_url":"https://api.github.com/repos/matthiasbeyer/libreset/milestones{/number}","notifications_url":"https://api.github.com/repos/matthiasbeyer/libreset/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/matthiasbeyer/libreset/labels{/name}","releases_url":"https://api.github.com/repos/matthiasbeyer/libreset/releases{/id}","created_at":"2014-06-06T14:08:42Z","updated_at":"2014-09-13T15:16:58Z","pushed_at":"2014-09-14T15:04:15Z","git_url":"git://github.com/matthiasbeyer/libreset.git","ssh_url":"git@github.com:matthiasbeyer/libreset.git","clone_url":"https://github.com/matthiasbeyer/libreset.git","svn_url":"https://github.com/matthiasbeyer/libreset","homepage":null,"size":2119,"stargazers_count":1,"watchers_count":1,"language":"TeX","has_issues":true,"has_downloads":true,"has_wiki":true,"forks_count":3,"mirror_url":null,"open_issues_count":15,"forks":3,"open_issues":15,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/matthiasbeyer/libreset/pulls/88"},"html":{"href":"https://github.com/matthiasbeyer/libreset/pull/88"},"issue":{"href":"https://api.github.com/repos/matthiasbeyer/libreset/issues/88"},"comments":{"href":"https://api.github.com/repos/matthiasbeyer/libreset/issues/88/comments"},"review_comments":{"href":"https://api.github.com/repos/matthiasbeyer/libreset/pulls/88/comments"},"review_comment":{"href":"https://api.github.com/repos/matthiasbeyer/libreset/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/matthiasbeyer/libreset/pulls/88/commits"},"statuses":{"href":"https://api.github.com/repos/matthiasbeyer/libreset/statuses/0ba82d539af0a044d5faa594a654259ddd2bd59a"}}}}