James Birkett
06-06-2010, 12:00 PM
Hi there,
I'm trying to understand vBulletin's use of bitfields and this has confused me. If anyone can clear it up, I'd appreciate it:
<group name="forumpermissions">
<bitfield name="canview" group="forum_viewing_permissions" phrase="can_view_forum" install="1,2,3,4,5,6,7">1</bitfield>
<bitfield name="canviewthreads" group="forum_viewing_permissions" phrase="can_view_threads" install="1,2,3,4,5,6,7">524288</bitfield>
<bitfield name="canviewothers" group="forum_viewing_permissions" phrase="can_view_others_threads" install="1,2,3,4,5,6,7">2</bitfield>
<bitfield name="cansearch" group="forum_searching_permissions" phrase="can_search_forums" install="1,2,3,4,5,6,7">4</bitfield>
<bitfield name="canemail" group="forum_viewing_permissions" phrase="can_use_email_to_friend" install="1,2,3,4,5,6,7">8</bitfield>
<bitfield name="canpostnew" group="post_thread_permissions" phrase="can_post_threads" install="2,5,6,7">16</bitfield>
<bitfield name="canreplyown" group="post_thread_permissions" phrase="can_reply_to_own_threads" install="2,5,6,7">32</bitfield>
<bitfield name="canreplyothers" group="post_thread_permissions" phrase="can_reply_to_others_threads" install="2,5,6,7">64</bitfield>
<bitfield name="caneditpost" group="post_thread_permissions" phrase="can_edit_own_posts" install="2,5,6,7">128</bitfield>
<bitfield name="candeletepost" group="post_thread_permissions" phrase="can_delete_own_posts" install="2,5,6,7">256</bitfield>
<bitfield name="candeletethread" group="post_thread_permissions" phrase="can_delete_own_threads" install="5,6">512</bitfield>
<bitfield name="canopenclose" group="post_thread_permissions" phrase="can_open_close_own_threads" install="5,6">1024</bitfield>
<bitfield name="canmove" group="post_thread_permissions" phrase="can_move_own_threads" install="5,6">2048</bitfield>
<bitfield name="cangetattachment" group="forum_viewing_permissions" phrase="can_download_attachments" install="2,5,6,7">4096</bitfield>
<bitfield name="canpostattachment" group="attachment_permissions" phrase="can_upload_attachments" install="2,5,6,7">8192</bitfield>
<bitfield name="attachlimit" intperm="true" group="attachment_permissions" phrase="space_in_bytes_attachlimit">1</bitfield>
<bitfield name="canpostpoll" group="poll_permissions" phrase="can_post_polls" install="2,5,6,7">16384</bitfield>
<bitfield name="canvote" group="poll_permissions" phrase="can_vote_on_polls" install="2,5,6,7">32768</bitfield>
<bitfield name="canthreadrate" group="post_thread_permissions" phrase="can_rate_threads" install="2,5,6,7">65536</bitfield>
<bitfield name="followforummoderation" group="post_thread_permissions" phrase="follow_forum_moderation_rules" install="1,2,3,4,5,6,7">131072</bitfield>
<bitfield name="canseedelnotice" group="forum_viewing_permissions" phrase="can_see_deletion_notices" install="5,6">262144</bitfield>
<bitfield name="cantagown" group="post_thread_permissions" phrase="can_tag_own_threads" install="2,5,6,7">1048576</bitfield>
<bitfield name="cantagothers" group="post_thread_permissions" phrase="can_tag_others_threads" install="2,5,6,7">2097152</bitfield>
<bitfield name="candeletetagown" group="post_thread_permissions" phrase="can_delete_tags_own_threads" install="5,6">4194304</bitfield>
<bitfield name="canseethumbnails" group="forum_viewing_permissions" phrase="can_see_thumbnails" install="2,5,6,7">8388608</bitfield>
</group>
Why does it go:
1, 524288, 2, 4, 8
I thought the generic method to go was: 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, etc?
I'm trying to understand vBulletin's use of bitfields and this has confused me. If anyone can clear it up, I'd appreciate it:
<group name="forumpermissions">
<bitfield name="canview" group="forum_viewing_permissions" phrase="can_view_forum" install="1,2,3,4,5,6,7">1</bitfield>
<bitfield name="canviewthreads" group="forum_viewing_permissions" phrase="can_view_threads" install="1,2,3,4,5,6,7">524288</bitfield>
<bitfield name="canviewothers" group="forum_viewing_permissions" phrase="can_view_others_threads" install="1,2,3,4,5,6,7">2</bitfield>
<bitfield name="cansearch" group="forum_searching_permissions" phrase="can_search_forums" install="1,2,3,4,5,6,7">4</bitfield>
<bitfield name="canemail" group="forum_viewing_permissions" phrase="can_use_email_to_friend" install="1,2,3,4,5,6,7">8</bitfield>
<bitfield name="canpostnew" group="post_thread_permissions" phrase="can_post_threads" install="2,5,6,7">16</bitfield>
<bitfield name="canreplyown" group="post_thread_permissions" phrase="can_reply_to_own_threads" install="2,5,6,7">32</bitfield>
<bitfield name="canreplyothers" group="post_thread_permissions" phrase="can_reply_to_others_threads" install="2,5,6,7">64</bitfield>
<bitfield name="caneditpost" group="post_thread_permissions" phrase="can_edit_own_posts" install="2,5,6,7">128</bitfield>
<bitfield name="candeletepost" group="post_thread_permissions" phrase="can_delete_own_posts" install="2,5,6,7">256</bitfield>
<bitfield name="candeletethread" group="post_thread_permissions" phrase="can_delete_own_threads" install="5,6">512</bitfield>
<bitfield name="canopenclose" group="post_thread_permissions" phrase="can_open_close_own_threads" install="5,6">1024</bitfield>
<bitfield name="canmove" group="post_thread_permissions" phrase="can_move_own_threads" install="5,6">2048</bitfield>
<bitfield name="cangetattachment" group="forum_viewing_permissions" phrase="can_download_attachments" install="2,5,6,7">4096</bitfield>
<bitfield name="canpostattachment" group="attachment_permissions" phrase="can_upload_attachments" install="2,5,6,7">8192</bitfield>
<bitfield name="attachlimit" intperm="true" group="attachment_permissions" phrase="space_in_bytes_attachlimit">1</bitfield>
<bitfield name="canpostpoll" group="poll_permissions" phrase="can_post_polls" install="2,5,6,7">16384</bitfield>
<bitfield name="canvote" group="poll_permissions" phrase="can_vote_on_polls" install="2,5,6,7">32768</bitfield>
<bitfield name="canthreadrate" group="post_thread_permissions" phrase="can_rate_threads" install="2,5,6,7">65536</bitfield>
<bitfield name="followforummoderation" group="post_thread_permissions" phrase="follow_forum_moderation_rules" install="1,2,3,4,5,6,7">131072</bitfield>
<bitfield name="canseedelnotice" group="forum_viewing_permissions" phrase="can_see_deletion_notices" install="5,6">262144</bitfield>
<bitfield name="cantagown" group="post_thread_permissions" phrase="can_tag_own_threads" install="2,5,6,7">1048576</bitfield>
<bitfield name="cantagothers" group="post_thread_permissions" phrase="can_tag_others_threads" install="2,5,6,7">2097152</bitfield>
<bitfield name="candeletetagown" group="post_thread_permissions" phrase="can_delete_tags_own_threads" install="5,6">4194304</bitfield>
<bitfield name="canseethumbnails" group="forum_viewing_permissions" phrase="can_see_thumbnails" install="2,5,6,7">8388608</bitfield>
</group>
Why does it go:
1, 524288, 2, 4, 8
I thought the generic method to go was: 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, etc?