Raised This Month: $ Target: $400
 0% 

Save Entity Index with BitSum


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 07-26-2022 , 19:52   Re: Save Entity Index with BitSum
Reply With Quote #1

Ok, I'll try to give you a quick visual

Lets use a 3-cell array

Cell 1 - 4 bytes/32 bits - 32 bits total
A single cell is perfect for player booleans since player ID's range from 1 to 32.
[ 0000 0000 ][ 0000 0000 ][ 0000 0000 ][ 0000 0000 ]

Cell 2 - 4 bytes/32 bits - 64 bits total
[ 0000 0000 ][ 0000 0000 ][ 0000 0000 ][ 0000 0000 ]

Cell 3 - 4 bytes/32 bits - 96 bits total
[ 0000 0000 ][ 0000 0000 ][ 0000 0000 ][ 0000 0000 ]

When you want to set bits beyond 32, you need to use an array, cell 2 holds bits 33 to 64, cell 3 holds 65-96, etc. Those macros do the work for you to set the appropriate bit.
__________________

Last edited by Bugsy; 07-26-2022 at 19:53.
Bugsy is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 15:33.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode