Save Entity Index with BitSum
Hi i wanted to know, how can i save an index for a client, with bitsums
PHP Code:
|
Re: Save Entity Index with BitSum
May be more work than it's worth, what are you trying to accomplish?
|
Re: Save Entity Index with BitSum
Quote:
PHP Code:
PHP Code:
|
Re: Save Entity Index with BitSum
Take a look at the Manipulating bits outside of the bit-range of a memory cell section here https://forums.alliedmods.net/showthread.php?t=139916
I assume you are looking to store index's larger than 1 to 32, so you need to use an array which will give you increments of 32 for each cell used. |
Re: Save Entity Index with BitSum
Quote:
|
Re: Save Entity Index with BitSum
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. |
Re: Save Entity Index with BitSum
Please don't do this in practice. There is absolutely no reason for it.
|
Re: Save Entity Index with BitSum
Quote:
|
Re: Save Entity Index with BitSum
This is why I asked for your use-case. It's not beneficial to use bit-wise operators/logic if you need to jump through hoops to accomplish it. There is likely a much simpler and economical way to do what are attempting
|
Re: Save Entity Index with BitSum
Quote:
Also, I have no idea what you're actually requesting. What does it even mean to "save an index"? Didn't you literally just write the code you needed in post #3? I think you'd need to provide context for what you are ACTUALLY trying to do so we can give you the best advice. |
| All times are GMT -4. The time now is 15:33. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.